turf
Water
icon='turfs.dmi'
icon_state="water"
density=1
Click()
if(!usr.fishing)
usr.canmove=0
usr.fishing=1
usr.client.screen+=new/obj/HUD/Reel
//Fishing Algorithm!
usr << "You begin to fish."
var/Fish=rand(50,70)
sleep(Fish)
if(prob(65))
usr << "You feel a nudge! Reel!"
usr.Do_Reel_Click=1
spawn(50)
if(!usr.Did_Click)
usr << "The fish broke the line."
usr.fishing=0
usr.canmove=1
return
else
usr.Did_Click=0
while(usr.Reel_Clicked)
usr << "You reel in the line."
usr.Reel_Clicked=0
usr.Did_Click=1
usr.Do_Reel_Click=0
sleep(Fish)
usr << "The fish is getting weak, quick, reel!"
usr.Do_Reel_Click=1
spawn(50)
if(!usr.Did_Click)
usr << "The fish broke the line."
usr.canmove=1
usr.fishing=0
return
else
usr.Did_Click=0
while(usr.Reel_Clicked)
usr << "You caught a fish!"
usr.Do_Reel_Click=0
usr.Reel_Clicked=0
usr.Did_Click=1
usr.canmove=1
usr.contents += new/obj/Fish
usr.fishing=0
return
else
usr << "You didn't get a bite."
usr.fishing=0
return
else
usr << "You are already fishing."
return
obj
HUD
Reel
icon='Reel.PNG'
screen_loc="13,13"
Click()
if(usr.Do_Reel_Click)
usr.Reel_Clicked = 1
else
usr.Clicked_Early = 1
mob/var
canmove
fishing
Reel_Clicked
Do_Reel_Click
Clicked_Early
Did_Click
Problem description:
I'm working on a fishing code, and when I attempt to fish, it displays, "You begin to fish.", "You feel a nudge! Reel!", and "The fish broke the line."
This is all fine and well, assuming I didn't click the "Reel" button, which I did. Using Deadron's debugger, I checked my variables that are related to this fishing code.
Canmove = 1
Did_Click = null
Do_Reel_Click = 1
Reel_Clicked = 1
If you look at the Water Click() code, those variables show that it recognizes the "Reel" button being pressed, but the while statement didn't kick in to continue the job. I think the problem is that while will only try to execute once, and if the value is 0, it ceases to try.
The problem is though, I need a piece of code that is instantaneous, in a way that as soon as you click the "Reel" button, it starts to execute the code. I thought that is what while did.
My question I suppose is am I using while improperly? And if so, what should I use in place of while to get the desired effect?
I will say that your whole system there is convoluted and excessive. KISS: Keep It Simple, Stupid. This is what I would do, brutally ripped from World of Warcraft:
Well, that actually ended up pretty long... but it's pretty complete, with the exception of data (which just goes into the global fishies list) and anything skill-related (which could go three ways: reduction of bobtime, increase in reaction, or a restriction on the Fish() proc being called from the water turfs).