ID:908635
 
(See the best response by A.T.H.K.)
Code:
mob/ToadSage
verb
SenninMode() // Verb used for firing the beam
set category = "Ninjutsu"
set name = "Sage Mode"
set desc = "Vine Field."
if(usr.chakra <= 500)
usr<<output("You dont have enough chakra!(500)","chat")
return
if(usr.resting)
return
if(usr.innaturalenergymode)
usr<<output("Revert Natural Energy Mode first!","chat")
return
if(usr.SenninModeUses >= 200&&!usr.insenninmode)
view()<<output("<font size=1><font face=verdana><b><font color=white>[usr]<font color=green> Says: <FONT COLOR=#0000ff>Sennin Mode<FONT COLOR=#2c969a>!</FONT><FONT COLOR=#008080>!</FONT>","chat")
usr.insenninmode = 1
usr.nin = usr.nin*2
usr.SenninModeUses += 1
usr.inspecialstate = 0
usr.verbs += new /mob/ToadSage/verb/NaturalEnergy()
usr.overlays += 'sennin mode mastered.dmi'
return
else if(usr.insenninmode&&!usr.innaturalenergymode)
usr.inspecialstate = 0
usr.verbs -= new /mob/ToadSage/verb/NaturalEnergy()
usr.insenninmode = 0
usr.icon = usr.Oicon
usr.nin = usr.Mnin
usr.overlays -= 'sennin mode.dmi'
usr.overlays -= 'sennin mode mastered.dmi'
view()<<"[usr].................."
return
else
view()<<output("<font size=1><font face=verdana><b><font color=white>[usr]<font color=green> Says: <FONT COLOR=#0000ff>Sennin Mode<FONT COLOR=#2c969a>!</FONT><FONT COLOR=#008080>!</FONT>","chat")
usr.insenninmode = 1
usr.SenninModeUses += 1
usr.inspecialstate = 0
usr.nin = usr.nin*1.4
usr.verbs += new /mob/ToadSage/verb/NaturalEnergy()
usr.overlays += 'sennin mode.dmi'
return

mob/ToadSage
verb
NaturalEnergy() // Verb used for firing the beam
set category = "Ninjutsu"
set name = "Natural Energy"
set desc = "Vine Field"
if(usr.chakra <= 500)
usr<<output("You dont have enough chakra!","chat")
return
if(usr.resting)
return
if(!usr.innaturalenergymode&&usr.insenninmode)
view()<<output("<font size=1><font face=verdana><b><font color=white>[usr]<font color=green> Says: <FONT COLOR=#0000ff>Natural Energy<FONT COLOR=#2c969a>!</FONT><FONT COLOR=#008080>!</FONT>","chat")
usr.innaturalenergymode = 1
usr.inspecialstate = 0
usr.overlays += 'sennin mode frogs.dmi'
OMFGNATURALENERGY
if(usr.innaturalenergymode)
usr.naturalenergy += pick(usr.Mchakra/20,usr.Mchakra/50,usr.Mchakra/30,usr.Mchakra/20)
usr<<"You gain more natural energy from the things around you."
usr.chakra += pick(usr.Mchakra/40,usr.Mchakra/100,usr.Mchakra/60,usr.Mchakra/40)
usr<<"The things around you give you some of their chakra."
sleep(400)
goto OMFGNATURALENERGY
else if(usr.innaturalenergymode)
usr.inspecialstate = 0
usr.innaturalenergymode = 0
usr.chakra = usr.Mchakra
usr.overlays -= 'sennin mode frogs.dmi'
view()<<"[usr].................."
return
Problem description: The problem is one of these codes crashes rthe game and i cant figure out what about this code is crashing the server please help me
                OMFGNATURALENERGY
if(usr.innaturalenergymode)
usr.naturalenergy += pick(usr.Mchakra/20,usr.Mchakra/50,usr.Mchakra/30,usr.Mchakra/20)
usr<<"You gain more natural energy from the things around you."
usr.chakra += pick(usr.Mchakra/40,usr.Mchakra/100,usr.Mchakra/60,usr.Mchakra/40)
usr<<"The things around you give you some of their chakra."
sleep(400)
goto OMFGNATURALENERGY


At no point in this snippet are you ever setting innaturalenergymode to false, so it loops forever.

For one, you shouldn't be using goto at all in this situation. Or using someone else's source code since I highly doubt you wrote this abomination.
so what could i do to fix it?
In response to Joejoe13 (#2)
Best response
Joejoe13 wrote:
so what could i do to fix it?

If you don't know how to define a variable I assume you are using someone else's source code which is bad and it's most likely a horribly programmed rip.

You should read the guide tutorials and reference.
I remember editing programs like this... I thought it was good programing back then, but in reality, it gave me missunderstandings and bad habbits which was hard to erase.

In code like this, everything is bad orginized, unefficient and horribly planned out. Don't fall in a trap and program like this. This is bad programming, and it will give you so many bad habbits later on.