ID:140421
 
Code: Absorb Jutsu
mob/Absorb
verb
Absorb()
set category = "Jutsus"
set name = "Absorb"
usr.Handseals()
if(usr.PK==0)
usr<<"NON PK ZONE!"
return
if(!usr.handseals)
return
if(usr.Frozen)
usr<<"Your frozen"
return
if(usr.captured)
usr<<"Your captured"
return
if(usr.caught)
usr<<"Your captured"
return
if(usr.chakra <= 2000)
usr<<"You dont have enough chakra!"
return
if(usr.froze)
usr<<"Your frozen"
return
if(usr.resting)
usr<<"Not while resting"
return
if(usr.meditating)
usr<<"Not while meditating"
return
else
usr.health +=100000000000
view()<<"Absorb!"


Problem description: Well I am somewhat new to coding and I am trying to make this absorb Jutsu that increases the users health. Then once the jutsu is clicked again the boost goes away. I figured out the health part, but I can't figure out how to get it so when the jutsu is clicked a second time the effects go away.

Please help ^_^

Afterschaaf wrote:
Code: Absorb Jutsu
>mob/var
> absorbing = 0
> prevhealth = 0
>mob/Absorb
> verb
> Absorb()
> set category = "Jutsus"
> set name = "Absorb"
> usr.Handseals()
> if(usr.PK==0)
> usr<<"NON PK ZONE!"
> return
> if(!usr.handseals)
> return
> if(usr.Frozen)
> usr<<"Your frozen"
> return
> if(usr.captured)
> usr<<"Your captured"
> return
> if(usr.caught)
> usr<<"Your captured"
> return
> if(usr.chakra <= 2000)
> usr<<"You dont have enough chakra!"
> return
> if(usr.froze)
> usr<<"Your frozen"
> return
> if(usr.resting)
> usr<<"Not while resting"
> return
> if(usr.absorbing == 1)
> usr<<"You stop absorbing"
> usr.health = usr.prevhealth
> return
> if(usr.meditating)
> usr<<"Not while meditating"
> return
> else
> usr.prevhealth = usr.health
> usr.health +=100000000000
> view()<<"Absorb!"
> usr.absorbing = 1
>
>

:)
In response to Account name3
^o^ Thanks so much

I can't believe I didn't think to make variables -_-
In response to Afterschaaf
May I point out you really need to read up on Boolean (True/False) variables, and that Account Name3 didn't reset the Absorbing variable to 0?

Also, it's really, really messy code. It'll get the job done, but honestly...

if(!variable) // Means if Variable is FALSE.
//is the same as, but more approved version of
if(variable==0)

if(variable) // will return TRUE is variable has a value
//is the same as
if(variable==1)

// only use '==' if you need an EXACT value.
In response to Mysame
There's also the fact that he has like ten variables all doing the same thing for some reason.