ID:164082
 
hey i finally got my logout mob to work. but now there is another problem well a continued problem with my inactivity check it doesn't boot when i am inactive but the message pops up after i have logged out right above my logout message. Is there a reason why its not working. could be be because i didn't define something right >.>. Here are the two codes plz help and let me know what i did wrong.(had help but i need more)

mob
Logout()
world<<"<World: [src]([src.key]) has logged off..."

world
New()
.=..()
spawn() BootCheck()

proc
BootCheck()
for(var/mob/M in world) if(M.client && M.client.inactivity>=30) {world<<"AI:([M]) has been kicked for being idle";M.Logout()}
Your BootCheck() is only running once when the world starts, that's why it's not booting anyone inactive. You need to create a loop that has it running that check at regular intervals (30 seconds, two minutes, whatever).

Also, client.inactivity counts in 10ths of a second, so at 30 players would only have been idle for 3 seconds. Not sure if that's what you want to happen or not.

(Shouldn't this be in Code Problems?)
In response to Evre
2 ways you make it continue: make it a while loop or tell it to come back to the proc after a bit of sleep or it'll check every 1/10th of a second.
In response to Evre
IN all technicality yes it should be but its a new game and i'm a new developer so technically it can be in both. But no not every 30 seconds and thanks for the info i wanted it to just check at 30 seconds so that way i could see if it works. So all i need to do is fix the loop i'll look into that and see if i can make one thanks for your help.
In response to Kakashi24142
Kakashi24142 wrote:
2 ways you make it continue: make it a while loop or tell it to come back to the proc after a bit of sleep or it'll check every 1/10th of a second.


So if i put 30 it means thats 30 at 1/10th of a second so its only 3 seconds so i need to make it loop at 300 10th's of a second to make it 30 seconds?
In response to Jason515
yea pretty much.
In response to Jason515
proc
BootCheck()
while(1)
for(var/mob/M in world) if(M.client && M.client.inactivity>=30) {world<<"AI:([M]) has been kicked for being idle";M.Logout()}
sleep(300)


Quick and dirty, but it ought to work.
In response to Kakashi24142
the only problem i have is making the loop all the built in guide tells me is default vaule 0 but it doesn't show me how to put it in >.>
In response to Evre
or
proc
BootCheck()
for(var/mob/M in world) if(M.client && M.client.inactivity>=30) {world<<"AI:([M]) has been kicked for being idle";M.Logout()}
sleep(300)
BootCheck()//go back to the prac again
In response to Jason515
look at evre's post for the loop
In response to Evre
Evre wrote:
> proc
> BootCheck()
> while(1)
> for(var/mob/M in world) if(M.client && M.client.inactivity>=30) {world<<"AI:([M]) has been kicked for being idle";M.Logout()}
> sleep(300)
>

Quick and dirty, but it ought to work.

see i was wondering how i would do that i went to look for loop checks and it just said default vaule to 0 lol. but that'll make it check every 30 seconds> should i change the inactivity to 300 as well.
In response to Kakashi24142
Kakashi24142 wrote:
look at evre's post for the loop

lol i just did ^_^ i had asked 1 last question. do you guys have any good references at the tuts that i should look into to help me get better at coding.
In response to Jason515
If you want it to kick players after being idle for 30 seconds, then yes.
In response to Jason515
changing inactivity to 30 seconds will mean that if the player is inactive for 30 seconds they will get booted, so if you that, change it.
In response to Evre
Evre wrote:
If you want it to kick players after being idle for 30 seconds, then yes.


Yes this is just a quick test to see if it works then if it does i'm going to make it for 5 mins of inactivity which should be like what 15,000 ? (math has always been my least favorite subject)
In response to Jason515
zilal's guide, kunark's guide(in byondscape.com), lummox jr's articles(byondscape)
In response to Jason515
3000 1/10th seconds (3000 1/10 of a second = 300 seconds/60 = 5 mins)
In response to Kakashi24142
cool i read the first guys when i first started but i couldn't get some of the coding/icon/s to load or work lmao but it was a good start. But i think Kunaks and Lummox is going to be good because lummox helped me with the code and it worked.....almost lol. He probably wanted me to figure it out but i don't understand the Guide its to generalized.(for me anyway)
In response to Kakashi24142
Kakashi24142 wrote:
zilal's guide, kunark's guide(in byondscape.com), lummox jr's articles(byondscape)


Ok i'm in game right now and its looping every 30 seconds like i wanted BUT its not booting me its giving me the messages like i signed out and telling me i was kicked up its not booting me. is that supposed to happen or is it because i'm host that its not booting me and closing the window.
In response to Jason515
Are you overriding your Logout() proc without returning to the parent (using ..()?)
Page: 1 2