Is that caused by automatic casting?

Post your scripting questions / solutions here

Moderator: Moderators

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

Is that caused by automatic casting?

Post by SilentAngel »

here I set a var as the map that's running

Code: Select all

local.map = getcvar(mapname)
here the sv_maplist is splitted into singolar variables containing the name of maps of sv_maplist one after one:

Code: Select all

local.maplist[local.i] = waitthread ... ...

this variables are well declared couse I checked them and they are all right!

but when I do that:

Code: Select all

for(local.i = 1; local.i <= local.total_maps; local.i++)
{
    if(local.maplist[local.i] == local.map)
    {
        if(local.i < local.total_maps)
            local.nextmap = local.maplist[(local.i + 1)]
        if(local.i == local.total_maps)
            local.nextmap = local.maplist[1]
    }           
}
the nextmap var seems NULL!!!!
also I don't have message in the console!!..
this have no sense in my opinion, couse local.maplist array is well made, I've checked them making them appear in console and they are good! local.map too is good, I also displayed it on console and it's right, but when I try to display local.nextmap nothing happend!!
I've thought at aut casting conflicts but usually the console display them all!!
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

It cannot be NULL, it must be NIL. But first, are you using elgan's script to split lines? Perhaps take a good look at the elgan's split_line description or take a look at my similar script:

Code: Select all

main:
	local.maplist = (getcvar "sv_maplist")
	local.map = waitexec global/strings.scr::split_line local.maplist 1 " "

	if (level.AIR_mapscript == NIL)
	{
		level.AIR_mapscript = waitexec global/strings.scr::to_lower (getcvar "mapname")
	}

	for (local.i = 1; local.i <= local.map[1].size; local.i++)
	{
		if (local.map[1][local.i] == level.AIR_mapscript)
		{
			local.f = (local.i + 1)
			if (local.f > local.map[1].size)
				local.f = 1

			local.match = 1
			level.AIR_nextmap = local.map[1][local.f]
			waitthread hud_nxtmap local.map[1][local.f]
			end
		}	
	}

	if (local.match != 1)
	{
		println "[AIR Nextmap::ERROR]: The current running map isn't in the maplist??"
	}
end
I hope you notice, the problem lies in the arrays.
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 »

are you using elgan's script to split lines? Perhaps take a good look at the elgan's split_line description or take a look at my similar script:
well I was looking foe elgan's script but didn't found it, so I made my own to fix my problem, here it is:

Code: Select all

string_splitter local.mystring local.word_num:

local.splitter = " "
local.temp_data = 0
local.words_count = 0
local.temp_data1 = 0

for(local.i = 0; local.i <= ((local.mystring.size) - 1); local.i++)
{
    local.o = (local.i - 1)
    if(local.i <= 0)
        local.o = 0
    if(local.mystring[local.o] == local.splitter && local.mystring[local.i] != local.splitter)
    {
        local.words_count++
        if (local.words_count == local.word_num)
        {
            for(local.e = local.i ; local.e <= ((local.mystring.size) - 1); local.e++)
            {
                if(local.mystring[local.e] != local.splitter)
                {
                    local.myword[local.temp_data1] = local.mystring[local.e]
                    local.temp_data1++
                }
                if(local.mystring[local.e] == local.splitter)
                {
                    end local.myword
                }
            }
        }        
    }
    if(local.i == 0 && local.mystring[local.i] != local.splitter)
    {
        local.words_count++
        if (local.words_count == local.word_num)
        {
            for(local.e = local.i ; local.e <= ((local.mystring.size) - 1); local.e++)
            {
                if(local.mystring[local.e] != local.splitter)
                {
                    local.myword[local.temp_data1] = local.mystring[local.e]
                    local.temp_data1++
                }
                if(local.mystring[local.e] == local.splitter)
                {
                    end local.myword
                }
            }
        }        
    }
}    
end local.myword
it's working good. the first time I tryed to use multidimensional arrays, but these I couldn't be able to return them..so I0ve made it using the word number, in fact I have to make a for cicle to get the full string splitted into multid. arrays, as shown:

Code: Select all

for(local.i = 1; local.i <= local.total_maps; local.i++)
{
    local.word_num = local.i
    local.map_list_map_num[local.i] = waitthread global/string_splitter.scr::string_splitter local.mystring local.word_num
}
however the scr works, and give no console errors, so I really don't get the problem...
It cannot be NULL, it must be NIL
I really don't know, becouse if it's NIL or NULL it still should be printed as NIL or NULL in console when I use printing functions! But nothing appeard on it, seems like the it has not been exec the printing section!! do you see what I mean?

however, the one of next map is a particular case becouse I had to change the scr I've posted couse of some lake! but the problem still came up in all if statement, when I compare the array that contains the map one by one of the maplist, with a string var as can be local.map!
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Yes. This is the exact same problem like the print commands in my huddraw tool I gave you. Are you sure developer is turned on? You can easily turn it on or off in the console, in game. Give it a try.
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 »

here developer is turned on as you can see:

Code: Select all

"C:\Programmi\EA GAMES\MOHAA\MOHAA_server.exe" +set dedicated 1 +set ui_console 1+set net_IP he.doesntexist.org +exec server.cfg +set developer 1
this is my server command line..

to fix print command problem, I for cicle as here:

Code: Select all

println "MAP-ADMIN WILL LOAD MAPS FROM HIS SCR:"
println "--------------------------------------"
println ("MAP-ADMIN: current map is " + local.map)
println "MAP-ADMIN: current scr is:"
println (local.mapscript_path)
println "MAP-ADMIN: map list is:"
for(local.i = 1; local.i <= local.total_maps; local.i++)
{
    print ("                       " + local.i + ")")
    for(local.e = 0; local.e <= ((local.maplist[local.i].size) - 1); local.e++)
    {
        print (local.maplist[local.i][local.e])
    }
    println ""
}
if(local.map == (string(local.maplist[1])))
    println "WOOOOHHOOOO!!"
println "MAP-ADMIN: map list end"
print ("MAP-ADMIN: next map is ")
for(local.i = 0; local.i <= ((local.nextmap.size) - 1); local.i++)
{
    print (local.nextmap[local.i])
}
println ""    
println "--------------------------------------"
and the result on the console is this:

Code: Select all

--------------------------------------
MAP-ADMIN: current map is dm/mp_Malta_DM
MAP-ADMIN: current scr is:
NIL  // here should be displayed the scr executed
MAP-ADMIN: map list is:
                       1)dm/mp_Malta_DM
                       2)dm/MP_Bahnhof_DM
                       3)dm/mp_Malta_DM
                       4)dm/mohdm1
                       5)dm/mohdm2
MAP-ADMIN: map list end
MAP-ADMIN: next map is //here should be shown the next map
--------------------------------------
as you can see, next map is nothing(not nil or null) and that's strange! also where should be displayed the scr executed it's NIL and that's strange a lot becouse there are no logical or lenguage errors!
also as you can see all maps are displayed but not the nextmap, so it can't be a printing problem becouse I used the same tecnique to print nextmap array and maplist variables!
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

If it prints nothing then it's not NULL or NIL, it's just an empty string. The variable gets assigned all right, but the data is wrong. I think your string breakdown routine is wrong.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

I think your string breakdown routine is wrong.
I don't understeand..
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Download the AP menu, take the strings.scr and use that one.
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 »

Could you gimme a link, couse I didn't found it, that's why I've made mine..
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Try this.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

lol
that was funny!
however I think I've founded the issue..later I'll check, I think I need to convert multidimensional arrays to singular dimensional arrays of string, I hope is that becouse I tryied with AP but still have problems..humm, I'll check! :)
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

okay, now the variable is displayed as NIL, so the problem must be here:

Code: Select all

if(string(local.maplist[local.i]) == local.map)
probably local.maplist has not been converted in string, while local.map is a string..so maybe that can cause the problem becouse all stuffs inside this if statement are not executed and local.maplist is obviously NIL..
that's my conclusion, can be so?
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Perhaps take a look at the description of Elgan's split_line function. I always use it and never had any problems.
// local.wordarray = waitexec global/strings.scr::split_line "hello_mummy" 1 "_"
// local.wordarray is a const array
//
// local.wordarray[1] = array of words
// local.wordarray[2] word count
// local.wordarray[3] full string with " " spaces
//
// local.wordarray[1][1] is 'hello'
// local.wordarray[1][1] is 'mummy'
//
// local.wordarray[2] is 2 'two words'
//
// local.wordarray[3] is 'hello mummy'
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 »

even if I use elgan's line splitter I still get the same message when printing the variable in console: type 'array'
I've also tryied to convert it to a string but STILL GET THIS @#[@# MESSAGE!! :evil:
At last I think i'm gonna abort this project..can't get splitted line to be usefull! unbeliv
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

LOOOOOOL!! okay problem fixed! looool! there was a ??@[][##@][[@]][##%?E GRAMMATICAL ERROR ON THE MAIN SCR!!! HUMM AND WHAT'S STRANGE IS THAT CONSOLE DIDN'T DISPLAYED IT!! WHAT A HAPPYNESS!! :P
Post Reply