ID:261969
 
Look at this AFK Code I made:

        AFK()
set desc = "(AFK) - Away from Keyboard"
var/is_afk = "You are already AFK!"
var/AFK = 0
var/last_x = src.x
var/last_y = src.y
var/last_z = src.z
var/is_afk = "You're already AFK!"
if(AFK == 1)
src <<is_afk
else
Write(last_x, last_y, last_z)
src.loc = locate(null)
world <<"[src] is AFK!"
switch(alert("You are currently AFK.","AFK")in list("I'm Back"))
if("I'm Back")
Read(last_x, last_y, last_z)



I always get a runtime error:

runtime error: bad file
proc name: AFK (/mob/verb/AFK)
usr: \[Designer] Kappa the Imp (/mob/characters/Wolf)
src: \[Designer] Kappa the Imp (/mob/characters/Wolf)
call stack:
\[Designer] Kappa the Imp(/mob/characters/Wolf): AFK()
dude,

var/AFK is bad
before this you should make it a mob variable, not just a new var created by the verb..

mob
var
AFK=0
AFK()
set desc = "(AFK) - Away from Keyboard"
if(usr.AFK == 1)
src << "You're already AFK!"
else
Write(last_x, last_y, last_z)
src.loc = locate(null)
world <<"[src] is AFK!"
switch(alert("You are currently AFK.","AFK")in list("I'm Back"))
if("I'm Back")
Read(last_x, last_y, last_z)


etc
In response to FireEmblem
FireEmblem wrote:
dude,

var/AFK is bad
before this you should make it a mob variable, not just a new var created by the verb..

mob
var
AFK=0
AFK()
set desc = "(AFK) - Away from Keyboard"
if(usr.AFK == 1)
src << "You're already AFK!"
else
Write(last_x, last_y, last_z)
src.loc = locate(null)
world <<"[src] is AFK!"
switch(alert("You are currently AFK.","AFK")in list("I'm Back"))
if("I'm Back")
Read(last_x, last_y, last_z)


etc

Fire, have you noticed that code is terrbile?

Try this:

        AFK()
set desc = "(AFK) -- Away From Keyboard"
var/last_x = src.x
var/last_y = src.y
var/last_z = src.z
var/AFK = 0
var/is_afk = "You are already AFK!"
if(AFK == 1)
src <<is_afk
else
world <<"[src] is AFK!"
src.loc = locate(null)
alert("Click 'Back' to return from AFK","AFK","Back")
src.loc = locate(last_x,last_y,last_z)
world <<"[src] returns from AFK!"


--SSJ4_Gohan_Majin
In response to SSJ4_Gohan_Majin
Thanks, Gohan!

-Kappa the Imp