Page 1 of 1

Ooops..console errors!

Posted: Mon Apr 27, 2009 6:59 pm
by SilentAngel
someone can tell me what's wrong with this?

Code: Select all

main:
    
    level waittill prespawn
    
    local.timeleft = (int(getcvar"timelimit")) * 60
    
    thread global/sp_initial.scr::variables_declaration
    
    thread main_of_the_mod
    
main_of_the_mod:
    
    while ( local.timeleft > 0 )
    {
        wait 1
        local.new_time = local.timeleft - 1
        local.timeleft = local.new_time
    }

    while(local.timeleft != 0)
    {
        thread global/Sp_ingame.scr::look_for_news
        waitframe
    }    
    
    while(local.timeleft != 0)
    {
        thread global/Sp_ingame.scr::check_for_new_players
        waitframe
    }    
        
    while(local.timeleft != 0)
    {
        thread global/Sp_ingame.scr::activated
        waitframe
    }    
    
    while(local.timeleft != 0)
    {
        thread global/Sp_ingame.scr::display_pool
        waitframe
    }  
    
    level waittill spawn
    
  
it's causing this error message in console
level waittill prespawn (global/spawnpool-mode.scr, 3)
level ^

^~^~^ Script Error: invalid waittill prespawn for 'Level'

while ( local.timeleft > 0 ) (global/spawnpool-mode.scr, 13)
while ( local.timeleft ^

^~^~^ Script Error: binary '>' applied to incompatible types 'NIL' and 'int'

Posted: Mon Apr 27, 2009 7:07 pm
by $oldier Of Ra
Your main thread gets activated. local.timeleft is defined. But, there's no end, so the engine continues and stumbles upon "main_of_the_mod:". Since there's no end, local.timeleft is still defined. HOWEVER, you have also threaded to the "main_of_the_mod:" thread, therefore the script starts that thread for a second time and since no variables are passed as arguments, local.timeleft is undefined in that second running thread, hence causing the error.

Posted: Mon Apr 27, 2009 7:14 pm
by SilentAngel
let see if I've understood:
it should be something like that..

Code: Select all

main: 
    
    level waittill prespawn 
    
    local.timeleft = (int(getcvar"timelimit")) * 60 
    
    thread global/sp_initial.scr::variables_declaration 
    
main_of_the_mod: 
    
    while ( local.timeleft > 0 ) 
    { 
        wait 1 
        local.new_time = local.timeleft - 1 
        local.timeleft = local.new_time 
    } 

    while(local.timeleft != 0) 
    { 
        thread global/Sp_ingame.scr::look_for_news 
        waitframe 
    }    
    
    while(local.timeleft != 0) 
    { 
        thread global/Sp_ingame.scr::check_for_new_players 
        waitframe 
    }    
        
    while(local.timeleft != 0) 
    { 
        thread global/Sp_ingame.scr::activated 
        waitframe 
    }    
    
    while(local.timeleft != 0) 
    { 
        thread global/Sp_ingame.scr::display_pool 
        waitframe 
    }  
end
    
    level waittill spawn 

Posted: Mon Apr 27, 2009 7:18 pm
by $oldier Of Ra
Indeed. As a detail these 2 lines are obsolete:

Code: Select all

main_of_the_mod: 
and the lonely

Code: Select all

level waittill spawn 
outside of the thread.

Posted: Mon Apr 27, 2009 7:28 pm
by SilentAngel
same error
level waittill prespawn (global/spawnpool-mode.scr, 3)
level ^

^~^~^ Script Error: invalid waittill prespawn for 'Level'
and that's what I've done:

Code: Select all

main:
    
    level waittill prespawn
    
    local.timeleft = (int(getcvar"timelimit")) * 60
    
    thread global/sp_initial.scr::variables_declaration
    
    while ( local.timeleft > 0 )
    {
        wait 1
        local.new_time = local.timeleft - 1
        local.timeleft = local.new_time
    }

    while(local.timeleft != 0)
    {
        thread global/Sp_ingame.scr::look_for_news
        waitframe
    }    
    
    while(local.timeleft != 0)
    {
        thread global/Sp_ingame.scr::check_for_new_players
        waitframe
    }    
        
    while(local.timeleft != 0)
    {
        thread global/Sp_ingame.scr::activated
        waitframe
    }    

    level waittill spawn
    
        while(local.timeleft != 0)
    {
        thread global/Sp_ingame.scr::display_pool
        waitframe
    }  
  

Posted: Mon Apr 27, 2009 7:46 pm
by $oldier Of Ra
Execute that script before prespawn, then it won't make that error again.
Or delete that line.
The wait is invalid because prespawn has already happened.

Posted: Mon Apr 27, 2009 7:51 pm
by SilentAngel
the fact is that I need to exec it from DMprechace, to load it for all maps..maybe delating the wait?

Posted: Mon Apr 27, 2009 7:58 pm
by $oldier Of Ra
Ah I see and in all stock maps the DMprecache it executed after prespawn hence the error. Well that's no problem, you can execute it in the DMprecache, deleting the waittill prespawn line in your script will prevent the error.

Posted: Mon Apr 27, 2009 8:00 pm
by SilentAngel
ok ty man