ID:171872
 
I asked about stopping movement before and some1 gave me this.

client/Move()
if(usr.Doing)
return
return ..()


It worked, but now it seems it just stopped working so when I do something that I have set to add 1 to doing it dosen't work.
First off, change usr to mob. It's not quite as dangerous to use usr in client/Move as it is in mob/Move, but still is a good idea to avoid it.

Whenever you want to halt, allow, or toggle between the two, change Doing to either 1 or 0.
mob
var/Doing=0
verb
halt_me()
Doing=1
let_me_go()
Doing=0
toggle_me()
set name = "Halt me if I'm moving, or let me go if I'm halted.
Doing=!Doing
give_me_a_random_surprise()
Doing=pick(50)
Are you setting Doing back to 0 later?
(I.E. if the action takes 30 seconds, do you have:
spawn(300) usr.Doing = 0
(Or src.Doing, if it's in a proc.))

Or is your problem simply that the Proc doesn't stop movmement?

[Edit] Oh, wait! I see a problem. Change the usr.Doing to src.Doing.
Remember young one, all procs (except for a few mouse-related procs) use src instead of usr.

[Edit] Another edit.
Change the client to mob. Unless the Doing variable is a client variable, that is....
Or you could change the src to mob. Either way should work.
In response to Roara
It still won't work, should I post my verb thats supposed to add 1 to Doing?
In response to Artekia
Please do. You can always check what Doing is by simply adding world<<Doing to Move(), that way knowing if it's changing or not everytime you move.
In response to JohnReaper
client/Move()
if(usr.Doing)
return
return ..()

obj
Rock
name = "Rock"
icon = 'rocks.dmi'
icon_state = "1"
density = 1
opacity = 1
verb
Mine()
set src in oview(1)
var/obj/pickaxe = locate(/obj/pickaxe) in usr.contents
if(pickaxe)
usr.Doing = 1
if(prob(35 + usr.luck))
spawn(300)
usr.contents+=new/obj/copper
usr << "You find copper!"
src.Mined += 2
if(Mined > 5)
del src
if(prob(25 + usr.luck))
spawn(300)
usr.contents+=new/obj/iron
usr << "You find iron!"
src.Mined += 2
if(Mined > 5)
del src
else
spawn(100)
usr << "You find nothing!"
src.Mined += 1
if(Mined > 5)
del src
usr.Doing -=1
usr.exp += 50
Exp(usr)
else
usr << "You have no pickaxe!"
In response to Artekia
Looks like Doing-=1 doesn't get called because you delete the rock before you Doing gets changed.


client/Move()
if(usr.Doing)
return
return ..()

obj
Rock
name = "Rock"
icon = 'rocks.dmi'
icon_state = "1"
density = 1
opacity = 1
verb
Mine()
set src in oview(1)
var/obj/pickaxe = locate(/obj/pickaxe) in usr.contents
if(pickaxe)
usr.Doing = 1
if(prob(35 + usr.luck))
spawn(300)
usr.contents+=new/obj/copper
usr << "You find copper!"
src.Mined += 2
if(prob(25 + usr.luck))
spawn(300)
usr.contents+=new/obj/iron
usr << "You find iron!"
else
spawn(100)
usr << "You find nothing!"
src.Mined += 1
usr.Doing -=1
usr.exp += 50
Exp(usr)
if(Mined>5)del src
else usr << "You have no pickaxe!"


I think that should fix it all up, just post again if there's trouble.
In response to JohnReaper
obj
Rock_CopperIron
name = "Rock"
icon = 'rocks.dmi'
icon_state = "1"
density = 1
opacity = 1
verb
Mine()
set src in oview(1)
var/obj/pickaxe = locate(/obj/pickaxe) in usr.contents
if(pickaxe)
usr.Doing = 1
if(prob(35 + usr.luck))
spawn(300)
usr.contents+=new/obj/copper
usr << "You find copper!"
src.Mined += 1
if(prob(25 + usr.luck))
spawn(300)
usr.contents+=new/obj/iron
usr << "You find iron!"
src.Mined += 1
else
spawn(100)
usr << "You find nothing!"
src.Mined += 1
usr.Doing -=1
usr.exp += 50
Exp(usr)
if(Mined>5)del src
else usr << "You have no pickaxe!"

I'm getting an error at the src.mined for iron that says missing expression
In response to Artekia
That's because you haven't declared a 'Mined' variable to the rock.
In response to JohnReaper
what?
In response to Artekia
The rock doesn't have a "Mined" variable, so you can't add/remove from it.
In response to JohnReaper
obj/var/Mined=0

I have that at top
In response to Artekia
I see the problem, you accidently added a space to it. It's tabbed correctly, but check carefully, you have a space in it.
In response to JohnReaper
lol, thx alot
In response to Artekia
Argh, it still lets me move when I'm mining
In response to Artekia
Then try this:

mob/Move()
if(src.Doing==0) ..()
In response to JohnReaper
still not workin :-((
In response to Artekia
Show the current code you have (including the rock and move())
In response to JohnReaper
mob/var/Doing=0
obj/var/Mined=0



mob/Move()
if(src.Doing==0) ..()

obj
Rock_CopperIron
name = "Rock"
icon = 'rocks.dmi'
icon_state = "1"
density = 1
opacity = 1
Mined = 0
verb
Mine()
set src in oview(1)
var/obj/pickaxe = locate(/obj/pickaxe) in usr.contents
if(pickaxe)
usr.Doing = 1
if(prob(35 + usr.luck))
spawn(300)
usr.contents+=new/obj/copper
usr << "You find copper!"
src.Mined += 1
if(prob(25 + usr.luck))
spawn(300)
usr.contents+=new/obj/iron
usr << "You find iron!"
src.Mined += 1
else
spawn(100)
usr << "You find nothing!"
src.Mined += 1
usr.Doing -=1
usr.exp += 50
Exp(usr)
if(Mined>5)del src
else usr << "You have no pickaxe!"
In response to Artekia
It's because of your spawn()s, if you want, you could use sleep() instead. (Be sure to change all the tabs!)
Page: 1 2