Ooops..console errors!

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Ooops..console errors!

Post 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'
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post 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 
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post 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
    }  
  
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

the fact is that I need to exec it from DMprechace, to load it for all maps..maybe delating the wait?
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

ok ty man
Post Reply