ID:166498
 

 obj
(Name) \\ name of object
icon = 'Daves.dmi'
icon_state = "speed"
density = 1
verb
Punch()
set name = "Punch"
set category = "Training"
set src in oview(1)
if (usr.resting==1)
usr<<"Not while resting"
if(usr.stamina >= 5)
if(usr.dir == 2)
flick("speed hit",src)
flick("punch", usr)
usr.random = rand(1,12)
if(usr.random == 12)
usr.move = 1
usr.stamina-=3
usr.icon_state = "punch"
usr.speed += 2
if(usr.random == 11)
usr.move = 1
usr.stamina-=1
usr.icon_state = ""
usr.speed += 1
else
usr.speed += 0

else
usr << "Please Face the bag.."




It maybe compleatly stupid of me, like a simple mistake but I was un able to locate to problem with my code?? it shows up in oview of one square and the verb appears but it just won't punch it and the actions for the bag to move and the character to punch won't start, and neither will the stats raise??

I know there's something stopping something or other from working, I think it has something to do with the "If" Functions....

try puting return on (if (usr.resting==1)
and u need an else to this
and to
if(usr.dir == 2)
u have 1 4 usr.stamina but not those 2
In response to Dazz513
I don't think changing the
"If" to else is going to quite work, or I may have mis understood you, could you repeat yourself more clearly please??
In response to Nexus6669
you dont change the if u make an else
for every if there has to be an else
the if and corresponding else have to be on the same tab
this is ur code

obj
(Name) \\ name of object
icon = 'Daves.dmi'
icon_state = "speed"
density = 1
verb
Punch()
set name = "Punch"
set category = "Training"
set src in oview(1)
if (usr.resting==1)<font color=red>//1 if there is no else on the same tab</font>
usr<<"Not while resting"
if(usr.stamina >= 5)//second if
if(usr.dir == 2)//3rd if no else
flick("speed hit",src)
flick("punch", usr)
usr.random = rand(1,12)
if(usr.random == 12)//4th if
usr.move = 1
usr.stamina-=3
usr.icon_state = "punch"
usr.speed += 2
if(usr.random == 11)//5th if on the same tab as 4th if so its good
usr.move = 1
usr.stamina-=1
usr.icon_state = ""
usr.speed += 1
else//else corresponding with 4th and 5th ifs
usr.speed += 0

else//else that goes wit the 2nd if
usr << "Please Face the bag.."
In response to Dazz513
obj
Bag
icon = 'Daves.dmi'
icon_state = "speed"
density = 1
verb
Punch()
set name = "Punch"
set category = "Training"
set src in oview(1)
if (usr.resting)
usr<<"Not while resting"
return
if(usr.stamina >= 5)
if(usr.dir == 2)
flick("speed hit",src)
flick("punch", usr)
usr.random = rand(1,12)
if(usr.random == 12)
usr.move = 1
usr.stamina-=3
usr.icon_state = "punch"
usr.speed += 2
if(usr.random == 11)
usr.move = 1
usr.stamina-=1
usr.icon_state = ""
usr.speed += 1
else
usr.speed += 0
else
usr << "Please Face the bag.."
else
usr << "Out of Stamina"
In response to Soldierman
exactly how soldierman posted
In response to Soldierman
Thanks alot, Much appriated :)
In response to Nexus6669
ur welcome
In response to Dazz513
Oh for some reason it works fine but the punchbag actions are working, but the character sort of disapears and re appears apon clicking Punch, I'm not sure but I think it's something to do with the icon, I have the player punching on NORTH,SOUTH,EAST,WEST with only 1 Frame and obviously 4 Dirs.


Anything wrong??
It's still doing it..