obj
Gravity_Chamber
icon = 'gravity.dmi'
icon_state = ""
density = 1
verb
Gravity()
set category = "Training"
set src in oview(1)
var/power = input("How much garvity would you like?") as num|null
if(power < 0)
usr << "<b>sorry but that not going to happen."
if(power == 0)
usr.gravity = 0
usr << "<b>You turn off the gravity...."
for(var/obj/gravitron/T in oview(6))
T.Gravity_On = 0
if(power >= 1 && power <= 500)
if(usr.gravity == 0||usr.gravity == null)
usr << "<b>You started felling presure on your body"
for(var/obj/gravitron/T in oview(6))
T.gravity = power
view(6)<<"[src] has set gravity to [T.gravity]x"
T.Gravity_On = 1
ret
if(T.Gravity_On == 1)
usr.MaxPowerlevel += T.gravity * (rand(1,5))
usr.Powerlevel -= T.gravity * (rand(1,10))
usr.energy -= (rand(1,5))
if(usr.Powerlevel <= 0)
usr.Death()
T.Gravity_On = 0
else
goto ret
else
..()
if(power > 500)
usr << "<b>The Gravity Chamber cannot withstand more than 500x gravity."
Problem description:
Well the problem is when i clcik on gravity and wehn i ype in a number for the gravity, the game frezzes, can some please help me with this.
You enter a loop(with goto, no less), yet you have no sleep() procs to be found. Basically, you will overwork your processor by trying to execute all of the code within the loop at the same time. Basically, there is no delay put inside or between each iteration of your loop.
I'll go ahead and hint at some other problems, while I'm at it....goto, if(variable==0),..() in the Gravity() proc(does nothing), if()-if()-if()-if() chain should be broken into an if()-else if()-else if()-else type of chain if nothing else.
Could probably go on, but I'm being called for.
Hiead