ID:144479
 
Code:AFK boot..
mob/Admin
verb
AFK_Boot()
world << "<b><font size=3>If you are here please say somthing in ooc to prove that you are here!"

for(var/mob/M in world)
if(M.Realplayer == 1)
AFK:Add(M)
M.isAFK = 1
sleep(100)
world << "<b><font size =3>Last Chance to say somthing."
sleep(10)
world << "<b>5"
sleep(10)
world << "<b>4"
sleep(10)
world << "<b>3"
sleep(10)
world << "<b>2"
sleep(10)
world << "<b>1"
for(var/mob/A in AFK)
world << "[A.name] was booted for being AFK!"
del(A)


Problem description: Um yea..AFK boot..kind ned one game is getin bigger and with that more EZers and paperweighters...I thought i had a system developed to boot those guys But for some reason the verb ends after the first part.."talk in ooc to prve u are here"..yea well when i attempted to use it, it comes up with a failed proc and cannot access list, but no errors when i compile it. Not sure why can someone help me?

The problems I see within that snippet are:
1) if(M.Realplayer == 1)

This, to me, seems like a boolean type of variable. Click here to read about Boolean safety/shortcuts

2) AFK:Add(M)

Do not abuse the :, use typecast (. -> At least I think that was the name).. and make sure you defined the variable as a list (and made it as a list and NOT a null as well: <code>var/list/AFK[0]</code>

3) M.isAFK = 1

Useless variable, I do not see it being used.

4) mob/Admin/verb

Use datum's instead: Admin/verb

5) <tags>

You are not closing your tags, bad programmer :P

6) Countdown

You could've shortened down the countdown timing from 5 to one:
for(var/i=1 to 5)
world<<"<b>[6-i]</b>"
sleep(10)


7) Your boot:

You simply bot out everyone in the AFK list. Now I do not know if you check + remove the people if they reply but you haven't used that tmp variable as well... so yeah...

- GhostAnime
In response to GhostAnime
o sorry forgot to add the ooc part..
hold on..after this maybe u can remove a few of those problems..
mob/verb/OOC(msg as text)

set desc = "Say something to everyone in the game"
var/list/L
L = list("font size","font color")

if(!usr.OOC)
alert("You are muted!")
return

if(usr.AFK == 1)
usr << "[text]"
AFK:Remove(usr)
usr.AFK = 0
for(var/mob/M in world)
if(M.key == "bugalee bugalee butchermans..bake me a cake as fast as u can")
M << "<font size=1><font face=verdana><B><font color=white>.:Owner:.<font color = silver>([usr.Village])-[usr]<font color=red>: [msg]"
else
M << "<font size=1><font face=verdana><font color=silver>([usr.Village])-[usr]<font color=green>: [msg]"


Okay with that the isAFk does come into use..that should cross off one problem..but ima look at some of yur suggestions and change my code and see if it works.
  • Close your font tags.
  • That's a bit of an ugly solution, don't you think? Having your Administrative verbs defined under a mob sub-type.
  • Boolean Shortcuts. if(var) is the equivalent to if(var == TRUE), if(!var) is equivalent to if(var == FALSE).
  • isAFK is, as stated below, useless. Just check if M is in AFK.
  • Do not place a space in between your attribute, assignment operator, and value in your HTML tags.
  • What's with Realplayer, anyways? If it does what I think it does, then M.client should suffice, but this appears to be a problem of not setting up your types properly.
  • You're abusing the : operator where you shouldn't need to. The . operator would work fine if you just defined AFK's type correctly, or if you typecasted it, which isn't necessary in this case. In this case, you want to make sure that AFK is defined as a /list.
  • You want to make sure that A is non-null in that loop.
revised..but still dont work..

var/list/AFK = list()

mob/Admin
verb
AFK_Boot()
world << "<b><font size=3>If you are here please say somthing in ooc to prove that you are here!"

for(var/mob/M in world)
if(M.Realplayer)
AFK:Add(M)
M.isAFK = 1
sleep(100)
world << "<b><font size =3>Last Chance to say somthing."
sleep(10)
for(var/i=1 to 5)
world<<"<b>[6-i]</b>"
sleep(10)
for(var/mob/A in AFK)
world << "[A.name] was booted for being AFK!"
del(A)
In response to SS10trunks
Okay i did mainly i think everything u said, but i get errors now in the coding..i get 2 indentation errors.
var/list/AFK = list()

mob/Admin
verb
AFK_Boot()
world << "<b><font size=3>If you are here please say somthing in ooc to prove that you are here!"

for(var/mob/M in world)
if(M.Realplayer)
AFK.Add(M)
M.isAFK = 1
sleep(100)
world << "<b><font size =3>Last Chance to say somthing."
sleep(10)

for(var/i=1 to 5)
//indentation error here
world<<"<b>[6-i]</b>"
//indentation error here
sleep(10)
for(var/mob/A in AFK)
world << "[A.name] was booted for being AFK!"
del(A)