String Arrays

BlitzMax Forums/BlitzMax Beginners Area/String Arrays

Pragun(Posted 2006) [#1]
Could someone please tell me what's wrong with this?

Global Strings:String[2,20] Strings[0,0]="Boxed In v.50" Strings[0,1]="Loading..." Global GameTitle$=Strings[$language,0] AppTitle = GameTitle

it keeps saying expecting expression but encountered $.
I would think that it would want a $tring? (Error points to Global GameTitle$ line)


much appreciated


tonyg(Posted 2006) [#2]
What this...
Strings[$language,0] 

?
Specifically the $Language part which is where the error occurs.
This works...
Global Strings:String[2 , 20] 
Strings[0 , 0] = "Boxed In v.50" 
Strings[0 , 1] = "Loading..." 
Global GameTitle$ = Strings[0, 0] 
AppTitle = GameTitle
Graphics 640 , 480
WaitKey()



fredborg(Posted 2006) [#3]
Yep, you cannot use that syntax. What you need to do is something like this:
Const LANGUAGE_ENGLISH = 0
Const LANGUAGE_SWAHILI = 1

Global lingo:Int = LANGUAGE_SWAHILI

Global GameTitle$ = Strings[lingo, 0] 
Or similar.


Pragun(Posted 2006) [#4]
oops. silly me. I looked at my code and didnt realize that i was trying to use language as a string! thanks much!


Pragun(Posted 2006) [#5]
Does anyone have an idea of how to do this?:

If version=0 then
 make the menu array have a size of 7
else
 make the menu array have a size of 6
end if

use the menu here


any & all help appreciated
pragun


Dreamora(Posted 2006) [#6]
if version=0
menu = new string[2,7]
else
menu = new string[2,6]
endif


for local i:int = 0 to menu.dimensions()[1]-1
'do something with entry [0,i] or [1,i]
next


Pragun(Posted 2006) [#7]
thanks