ID:170562
 
ok, i am trying to get an AFK verb to where if a player is dead, he can go afk, but it will not teleport him back to the starting point, still dead, but in the world. this is what i have so far...

mob/var
afk = 0


mob
verb
AFK()
set category = "Communication"
set name = "Going AFK"
if(usr.dead == 1)
usr.afk = 1
npc = 1
if(usr.afk == 0)
usr.afk = 1
usr.move = 0
npc = 1
usr.loc=locate(61,69,5)
world << "[usr.name] is now AFK."
else
usr.afk = 0
usr.move = 1
npc = 0
usr.loc = locate(77,77,1)
world << "[usr.name] is back from AFK."
else
usr.afk = 0
npc = 0
usr<<"You return from AFK"


am i going about this the wrong way, or am i half wrong about how i did this? any input would be much appreciated. thank you
Young grasshopper, you must use robust methods!
mob/verb/afk()
src.afk=!src.afk
src.move=!src.move
src.npc=!src.npc
world << src.afk ? "[src] is afk." : "[src] is back from AFK."
if(src.dead)
src.loc = locate(13,37,1)
else if(!src.dead)//or it could be just else
src.loc = locate(9,1,1)

Try something along the lines of that.
In response to Hell Ramen
thank you, Master. I am still learning oh wise one...i do appreciate it and Ill let you know if its good or bad.
In response to Twizted1
_> You just made me chuckle.
In response to Twizted1
mobs.dm:404:error:src.afk:undefined var
mobs.dm:404:error:src.afk:undefined var
mobs.dm:407:error:src.afk:undefined var
mobs.dm:407:? :warning: statement has no effect

using the above method, these are the errors i get.do i set the var seperately? or how would i go about defining the src.afk var? defining the vars is usually what gets me confuzed. lol.
In response to Twizted1
o.o
The thing you had;
mob/var
afk = 0

Should have afk defined.

And, also...
I don't know why you got a statement thingie for "?"...
Try
var/q = src.afk ? "[src] is afk." : "[src] is back from AFK."
world << q

in place of that.

In response to Hell Ramen
sweet it works, master. but one thing is that if the player is dead, and you go afk, he still keeps his halo, and when you try to return from afk, it leaves you in the same place. pretty much the thing i am going after is, if you go away for a minute, you wont get killed by people who decide AFK's are easy prey. i was thinking, if someone goes afk, into a different zone, that they will not get killed nor be able to join the rest of the world if they were already dead. phew, thats alot to type master. lol
In response to Twizted1
Okay, by my belief, your npc var makes it so they can't get attacked...so, remove the halo like how you applied it. Or make it so you can't go AFK while dead. ;p
In response to Hell Ramen
ok ill do that, while dead you can't go afk. sorry if i have wasted your time master, but i am learning the wise ways of O-Hell Ramen-i ( lmao like the Jedi's) lol
In response to Twizted1
;o
You can stop calling me master...even though it is quite flattering.
And my question is, why WOULD you want to go AFK while dead?
In response to Hell Ramen
well like me, usually when i die, its either my dogs i have to tend to, or the trash needs taking out, so i need to go afk for a little while. i played one game to where, when i did go afk, id get it'd to and murdered alot to gain the other players strength and levels until i came back from afk. so im tryin to make it fair as i can. but when someone logs into my game when i am finished, its gonna be all out war, there will be no hiding in cities, lol. i do thank you for your help, and i see it as youve been here longer than i have and know more than i do, so if i feel as if i am stumped, i usually post, but thats usually far and inbetween. i have a lot of reading to do, and alot of learning yet.
In response to Twizted1
It's okay, I was more of a uber nuber then you when I started out.(And I still am one, so, yeah.) :)
In response to Hell Ramen
lol ive almost got xp memorized like the back of my hand, but then i come back to byond, and im like @[email protected](uhhhh)

but its cool, one last question then ill leave you alone, in this format, how would i add a category name and set name? this is what ive tweaked a little bit to basically have it like i was saying earlier:

mob/var
afk = 0


mob/verb/afk()
src.afk=!src.afk
src.move=!src.move
src.npc=!src.npc
var/q = src.afk ? "[src] is afk." : "[src] is back from AFK."
world << q
if(src.dead)
usr << "You cannot move nor get killed while AFK."
else if(!src.dead)//or it could be just else
world << q

im used to tabbing them out one by one. sorry.
In response to Twizted1
It always goes at the top. :)
mob/verb/afk()
set category = "Category of your choice"
set name = "Name of your choice"
//other stuff here

In response to Hell Ramen
ah ok, my brother jus told me about the spaces, so i see where it goes now, thank you.
In response to Hell Ramen
Hell Ramen wrote:
And, also...
I don't know why you got a statement thingie for "?"...
Try
var/q = src.afk ? "[src] is afk." : "[src] is back from AFK."
> world << q

in place of that.

The reason is because the << operator is expecting text. Do this:

world << "[src.afk ? "[src] is AFK." : "[src] is back"]"
In response to Wizkidd0123
Wizkidd0123 wrote:
Hell Ramen wrote:
And, also...
I don't know why you got a statement thingie for "?"...
Try
var/q = src.afk ? "[src] is afk." : "[src] is back from AFK."
> > world << q

in place of that.

The reason is because the << operator is expecting text. Do this:

world << "[src.afk ? "[src] is AFK." : "[src] is back"]"


The << operator will accept a number just as well. (world << 5 works as expected.) His problem arose from order of operations. << is a higher order than ?. Simply placing it in ()s will correct that. (With out ()s, you get a "statement has no effect" warning, and no output.)
world << (src.afk ? "[src] is afk." : "[src] is back from AFK.")
In response to Wizkidd0123
Oooooh, thanks Wizzie.
In response to Nova2000
Never thought of that. Thanks, Nova =)