Blitzbasic -> blitzmax

BlitzMax Forums/BlitzMax Beginners Area/Blitzbasic -> blitzmax

Olla(Posted 2006) [#1]
Hi, I got experience with Blitzbasic, but I'm a Blitzmax noob :-) ... I'm using an older version (1.09) because I can't get the newer updates to work together with the unofficial Mappy libs, for whatever reason. Anyway, everything is basically working fine with 1.09, but I have a problem getting following like to work under Max:


blks[n].bg = blks[aniseq[anis[a].ancur]].bg

Where n is the tile/block number and a is the animation number...
I get a compile error: Expression of type 'int' cannot be indexed... This question is probably only for people with experience with BM + the title editor: Mappy...

Any help on this is much appreciated.


Dreamora(Posted 2006) [#2]
This means that one of the 3 arrays you use there isn't an array and most likely would return one (-> change [..] to ()[..]).

And I would strongly suggest that you use 1.20 as 1.09 has some serious issues. Its far easier to get mappy to work with it than getting the problems out you have (DX etc)


Olla(Posted 2006) [#3]
@Dreamora, thanks for you prompt feedback.. I have tried to change what you suggested, but still not working... Maybe by posting following code snippet from Mappy pub.lib, you can help me figuring out how the line should be:

Type BLKSTR
Field bg:Int, fg:Int, fg2:Int, fg3:Int
Field user1:Int, user2:Int, user3:Int, user4:Int, user5:Int, user6:Int, user7:Int
Field tl:Int, tr:Int, bl:Int, br:Int
Field trigger:Int, unused1:Int, unused2:Int, unused3:Int
EndType

Type ANISTR
Field antype:Int, andelay:Int, ancount:Int, anuser:Int
Field ancur:Int, anstart:Int, anend:Int
EndType

Type MappyMap
Field mapmaxlayers:Int=2
Field maperror:Int
Field mapislsb:Int, maptype:Int
Field mapchunkdone:Int
Field maptrans8:Int, maptransr:Int, maptransg:Int, maptransb:Int, maptransval:Int
Field mapwidth:Int, mapheight:Int
Field mapblockwidth:Int, mapblockheight:Int, mapdepth:Int
Field mapblockstrsize:Int, mapnumblockstr:Int, mapnumblockgfx:Int
Field mapblockgapx:Int, mapblockgapy:Int
Field mapblockstaggerx:Int, mapblockstaggery:Int, mapclickmask_fld:Int
Field mapcurlyr:Int, mapnumanims:Int

Field mappt:Int[][][]
Field aniseq:Int[]
Field tilegfx:TImage[]
Field cmappt:Int[]
Field blks:BLKSTR[]
Field anis:ANISTR[]

Method MapFreeMem()
Local n:Int

For n = 0 To (mapnumblockstr-1)
blks[n]=Null
Next
For n = 1 To (mapnumanims)
anis[n]=Null
Next
For n = 0 To (mapnumblockgfx-1)
tilegfx[n]=Null
Next

anis=anis:ANISTR[..0]
blks=blks:BLKSTR[..0]
tilegfx=tilegfx[..0]

EndMethod

__________________________________________

Regarding upgrade to 1.20, you are so right .. I tried to upgrade to 1.20 but it resulted in nothing worked anymore, which scared me off and I went back to 1.09... I guess I just need to do some more research into how to get this working..

Thanks in advance....


gman(Posted 2006) [#4]
greetings Olla :) the current version of the mappy lib will not work on a version of BMAX that old. there were extensive changes to how the images were read from the mappy file back when BMAX v1.16 or v1.18 came out which causes it to be incompatible with anything earlier. the best option i think is to first get assistance in getting your BMAX v1.20 up and running and then work on getting mappy going (which should be pretty easy at that point).


Olla(Posted 2006) [#5]
Greetings Gman ... Thanks for your input .. the v1.20 worked, but it was just everything related to Mappy that didn't ... And as I said, that was kind of frustrating to me .. I will try to upgrate to 1.20 again and then take it from there ...


gman(Posted 2006) [#6]
sounds good. get upgraded and we will get you going after that. mappy works fine with 1.20 so when you get it upgraded we can get you going based on any error messages and what not.


Abomination(Posted 2006) [#7]
I also had problems installing the Mappy.mod. I had to do several different runs and i'm afraid I can't remember what sequence did the "trick".
But once I had it working I found it to be rather slow and the examples were running "jittery" espacialy when scrolling by the keyboard.
Something in my setup? Or is this more common?


gman(Posted 2006) [#8]
@Abomination - there are two timing methods in the examples. if you hit the spacebar (i think its spacebar) the jitter will probably go away.


Olla(Posted 2006) [#9]
@gman, so here is what I did:

1) Deinstalled Blitzmax v1.09 ..
2) Installed version v1.18
3) Then updated it to 1.20
4) copied the mappy.mod dir into the pub.mod folder..
5) Started blitzmax 1.20, loaded my program and compiled it...

Got following compile error: Compile Error: Can't find interface for module 'pub.mappy'

In my program have following:

Import Pub.Mappy
Global map:MappyMap=New MappyMap

Any idea as to why this error appears?

Thanks in advance.


gman(Posted 2006) [#10]
that i do. i hadnt put out a new distro compiled for BMAX 1.20+.

please download:

http://www.gprogs.com/pub.mappy/2006_07_27_mappy.zip

and replace with your current one.


Olla(Posted 2006) [#11]
ok, copied the new "mappy.mod" folder into following location:

C:\Programs\BlitzMax\mod\brl.mod

changed "import Pub.Mappy" to "import Mappy" in my program.

Now I tried to compile it, but got following error message:

Compile Error: Can't find interface for module 'pub.stdc'
[C:/Programs/BlitzMax/mod/brl.mod/stream.mod/stream.debug.win32.x86.i;21;1]


gman(Posted 2006) [#12]
almost :) move mappy.mod into pub.mod. the directory structure should look something like:

c:\programs\blitzmax\mod\pub.mod\mappy.mod

leave the "import pub.mappy" as is. also, i have some samples available for download as well to see if it works.

http://www.gprogs.com/pub.mappy/mappysamples.zip

for the stdc issue, i would say run sync modules from the programs menu in blitzmax to see if you can resolve that.


Abomination(Posted 2006) [#13]
ah.
That version installed without trouble.
But the scrolling jitters so much its almost bouncing.
(with or without spacebar)
It could be something in my windows/hardware-config. but I didn't notice something like this before.


tonyg(Posted 2006) [#14]
I use the 'old' Mappy mod at 1.20. When I got the
Can't find interface for module 'pub.mappy'
message I rebuild modules and it then works OK.


Olla(Posted 2006) [#15]
@gman, it works!!! Thank you very much for your help... There were a few issues but they were easy to fix.

Now maybe you can also help me with one more thing? ;-)

With mappy You can change the graphic used for a block with:

blks[n].bg = newgraphicnumber

n is the block number, newgraphicnumber is the number of the graphic to replace the bg with. Now every block 'n' in the map will have the new graphic. This all works just fine, but what I'm really trying to do is to replace 'n' block with an animation instead. So if I make an anim 'a' (the first anim is 1) I want to use, I should be able to update block 'n' manually by using following line in each loop:

blks[n].bg = blks[aniseq[anis[a].ancur]].bg

The problem is that this line won't compile in Max. I get following error: Expression of type 'int' cannot be indexed

Dreamora comment on this issue:
"This means that one of the 3 arrays you use there isn't an array and most likely would return one (-> change [..] to ()[..])."

I have tried to change what Dreamora suggested, but can't get it to work.. Do you have an idea of how this line should be in Max to work?

Thanks in advance..