ID:166564
 
Hello I have a problem, I have made the character so that he lifts a weight...

However the character stays still apon clicking lift and the weight is made so that it animates as if he was lifting it, the only problem is, I can still move why the weight is animating and the stats still go up. I have tried the "usr.move=1" and "usr.move=0" code and I am still able to move him after I click lift, I need him to stay there, basicly freeze untill I click lift again to make him stop, here's my code so far...:

 obj
icon='Test Tube.dmi'
icon_state="weights"
layer=MOB_LAYER+1
verb
Lift()
set category="Action"
set src in oview(0)
if(usr.lifting==1)
usr.lifting=0
icon_state="weights"
else
usr << "You start lifting"
icon_state="lifting weight"
usr.move=1
usr.lifting=1
AGAIN
if(usr.lifting==0)
return
usr.move=0
else
var/random=rand(1,2)
var/stam=rand(1,2)
usr.powerlevel+=random
usr.stamina-=stam
sleep(10)
goto AGAIN
1) For Boolean variables (variables that can only be 1 or 0/true or false) you should do if(var) and if(!var) instead of if(var==1) and if(var==0).

2) There's no real reason to use goto in there, you're better off using while().

3) Look up return.

As for your actual problem, what makes you think setting usr.move to 0 will stop the mob from moving? Show us your mob/Move() code as that's relevant to the problem.
In response to DeathAwaitsU
Can you explain what I will need to do again please, could you re-write the code I submited and correct it to how it should be done please :)
In response to Nexus6669
What don't you understand? Be very specific.

And I won't rewrite your code for you.
In response to DeathAwaitsU
Ok fair anough, I only asked if you could basicly copy my code and simply make the changes for me, but of course if you are not used to giving people favours then that's your problem,


Ill try understand more with what you writ,


Thanks alot.
In response to Nexus6669
Also the fact is I'm a begginer coder so I get confused easy with lot of the language, even if you don't re-write it for me, could you explain a bit more please, sorry about this but you got to understand ,


So I replace "GOTO" with that "While()"?
In response to Nexus6669
No. You look up while() in the help file to understand what it does. Then you create a verb to test how it works. THEN you put it in your code to make it work properly.

As for you other comment, I didn't refuse to help you. I asked you to be more specific about your problem rather than saying that you don't understand since I don't know what you don't understand.

And the reason I won't rewrite it for you is because you won't really learn much from it because you'll just copy and paste it and even if you try to understand it, you'll either just give up or you won't understand how to apply it to a number of situations - you'd only understand how to apply it to one situation.

As for the new topic you just created, defining a variable called "move" or called "lock_movement" doesn't mean the Dream Maker understands that you're trying to freeze the player. To Dream Maker, move could mean anything - it doesn't understand english.

One more thing, if you didn't even know about while(), read the DM guide:

http://www.byond.com/docs/guide/

It'll teach you plenty of skills.
In response to DeathAwaitsU
Thank you... I do agree with what you writ so far, and I will try to understand it better.

Ill look up While() right now.


Seya
Refrain from double-posting topics. Bump the other topic if it's off the main page (in Topic View) and no-one has replied to it within 24 hours.