ID:144142
 
Code:
proc
Timer()
while(worldtime>0)
if(reboot)
return
if(paused)
sleep(10)
continue
worldtime--
sleep(10) //this is line 18
world<<"<b><font face=arial black><font color=red>GAME:The non-ITs win!"
PickFreezeWinner()
PickUnFreezeWinner()
for(var/mob/E in players)
if(!E.it)
E.GamesWon++
spawn(90)
world.reboot()


Problem description:
runtime error: type mismatch
proc name: Timer (/proc/Timer)
source file: Procs.dm,18
usr: KirbyAllStar (/mob)
src: null
call stack:
Timer()
: Begin Regular()
KirbyAllStar (/mob): Regular Freeze Tag - GM()


I've gotten type mismatch before and usually it was a stupid error on my part, but this time I don't see the problem. Anyone know whats wrong with it?
It can't actually be the sleep() line of course, so it got the wrong line. Also, are you calling reboot instead of Reboot on purpose? If already you should probably just override world/Reboot() than create another proc.

Now IIRC the ++ and -- operators are quite durable, so I assume it was really off in determining the error line and its while(worldtime>0). The '>' is less durable, perhaps worldtime is a text string or some such and not a number?

Also, about your font tags... You can have multiple attributes in a single font tag, no reason to have 2 like you've done. If you want an attribute to include spaces, put quotes (I think both single and double quotes are ok, though don't mix them) around the value. It is generally advised to always put quotes though you don't need to unless you have spaces.
"<font face='arial black' color=red>aaa</font>"
In response to Kaioken
Yeah reboot was on purpose, and to override it I would just not call ..() in the Reboot, right?

Found the problem, this error only happens when someone uses the reboot verb which calls reboot() and for some reason I used...
worldtime=""


Thanks for pointing out the thing about the text string.

-KirbyAllStar
In response to Kaioken
Having another reboot function is better than overriding. There may be some things you want to do before a reboot, and other times, you might just want it to reboot right away.
In response to CaptFalcon33035
Yeah I'm actually never "Rebooting" the game, I don't like the fact that when you call Reboot(), the security certificate will fail for most of the players, so I have one that resets everything that needs to be and takes everyone back to the join screen.

-KirbyAllStar
In response to CaptFalcon33035
So you simply pass an optional argument to your overridden Reboot(). Show some creativity. :P
In response to KirbyAllStar
KirbyAllStar wrote:
so I have one that resets everything that needs to be and takes everyone back to the join screen.

Ah, well in that case, it isn't an actual reboot at all as it doesn't restart the server. Then you should try and fine a better name for it than reboot(), something that implies send_players_to_title_screen()
In response to Kaioken
I totally agree, though that name could be a little too large and unspecific. How about Reset_World() or something?
In response to KirbyAllStar
Well, wait, what's the point in the reboot then? Are you creating a game that needs to restart often?
In response to CaptFalcon33035
Yeah, its a freeze tag game and "restarts" after every round so that no one is IT, no one is frozen, no one is a spectator, it resets my lists and so on...

I could do a reboot after every round but when i did that, it kicked nearly everyone everytime.
In response to CaptFalcon33035
Yeah, whatever floats his boat. I didn't really offer that name, but just something that implied what the proc is actually doing.