How to do this in bmax? and million more Q. likely
BlitzMax Forums/BlitzMax Beginners Area/How to do this in bmax? and million more Q. likely
| ||
I get "Expression of type 'Int' cannot be indexed" when i run the following code that worked in b3d. This was nifty way to get a batch of images loaded in b3d For i=1 To 20 NumberList[i] = LoadImage ("C:DungeonCrawlGameMap editorBmpNumbersNumber" + Str[i] + ".bmp") Next |
| ||
You need to declare the array first, and also, it must be of type TImage if you're loading Images into it. Also, arrays are 0-based in Blitzmax (I can't remember about Blitz3D), so declaring an array with 20 elements, they will be numbered 0-19. Strict Global NumberList:TImage[20] For Local i:Int = 0 To 19 ' variable 'i' will now be local to this For/Next loop only NumberList[i] = LoadImage ("C:DungeonCrawlGameMap editorBmpNumbersNumber" + String(i) + ".bmp") Next Also, put "Strict" right at the top of your code. This forces you to declare all variables before using them - may seem like an inconvenience but it makes debugging a hell of a lot easier later. Last edited 2012 |
| ||
Ok. I skipped posting the array declaration, but i shouldn't have since you ended up pointing out the TImage type issue that I wasn't aware of. Thanks for the tips and time to answer these questions and many more to come as I learn blitzmax. |
| ||
hmm, still not working. I get an "Identifier 'Str' not found." Global NumberList:TImage[20] For i = 0 To 19 NumberList[i] = LoadImage ("C:DungeonCrawlGameMap editorBmpNumbersNumber" + Str[i] + ".bmp") Next |
| ||
Gfk was casting to an Int to a String, you copied his code wrong... although you don't need to cast:NumberList[i] = LoadImage ("C:DungeonCrawlGameMap editorBmpNumbersNumber" + i + ".bmp") Also that path looks wrong too... where are your images? C:DungeonCrawlGameMap editorBmpNumbersNumber???? maybe it should be: C:DungeonCrawlGameMapeditorBmpNumbersNumberor something.... Last edited 2012 Last edited 2012 |
| ||
Oops. You are right. lol. The forward slash for the path were deleted when i posted. Not sure why. Last edited 2012 |
| ||
Yeah the slashes are being removed... |
| ||
And try putting the word SuperStrict at the top of your source. It will help you. Really! :-) |