ID:150080
 
I'm having a problem with my code where a user is able to click on something even while the objects "Click" proc is being executed, which invilves bringing up a prompt window. For example, when a player clicks on a monster to bring up the combat menu, they are still able to click on the monster while the prompt is up, resulting in multiple instances of the compat menu coming up. I don't want this to happen. I don't want the user to be able to do anything but pick from the menu, ar at least not be able to click on anything else while in a prompt menu. What's the most convenient way to accomplish this? I don't think I need to show my code, seeing as how it's not a problem that would be unique to me...

Laif
In these instances, I usually create a variable that checks if something is happening. When I call Click() check to see if that variable has a value. If it does, return. If not, then set it to 1 and continue on your way.
You could make a var and check that during a click, something like:

mob
var
clicked = 0

mob/Blah
icon='blah.dmi'
Click()
if(usr.clicked)
..()//does no action
else
usr.clicked=1
switch(input("What do you want to do")in list("Attack","Nothing"))
if("Attack")
//attack code
usr.clicked=0
else
..()
In response to Evilkevkev
Yeah, that's what I was thinking too, but I was just wondering if there was a quick one-liner that I could add to the Click procs that I have, like some odd use of spawn() or something like that.

Laif