forums

TNT Basic Forums > Programming Q&A
I really don't get this map stuff...
< Last Thread     Next Thread >
Author
Thread        Post A Reply

01-26-2004 15:35

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

Ok.
I have the code


unload map 128
load map 129
set current map 129
open map viewport 1,0,339,23 to 610,276


And the first thing it does is show me map 128.

And even worse, If I use the code:


unload map 128
load map 129
unload map 129 'line # x
set current map 129
open map viewport 1,0,339,23 to 610,276


I get an error report at line # x telling me that I should try loading map 129 because it is currently not loaded.

Help?
MapMaker

01-26-2004 18:56

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

unload map 128
load map 129
unload map 129 'line # x
set current map 129
open map viewport 1,0,339,23 to 610,276


it looks like the error on line # x is because you unload map 129 and then try to set it as the current map. that dosn't seem right to me, but i've never used maps in tnt basic.

01-26-2004 22:05

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

Seriously...

*** Runtime exception caught ***
Line# : 687
Code : set sprite priority 2,1
Error : Canvas 1 not open.


Huh?
I must be missing something. What does setting sprite priority have to do with the canvas??

Puffin:
I realised that after I posted but the problem is on the line before that one.

Sorry if I'm just being stupid..
MapMaker

01-27-2004 12:58

Posted by:
Miles

Location:
Australia

Click Here to Email Miles   Find more posts by Miles

Man, that sounds identical to a problem I had with Druid. I got so frustrated I deleted the 'unload map' command altogether (Even if I put Load Map immediately before it, it said the map wasn't loaded). So, I guess if you play Druid too many times in a row it would eventually run out of memory.

Have you read Eric's post in Bugs about unload map? There's definitely something weird going on with that command...

01-27-2004 23:03

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

MapMaker,
Can you create the bug in a simple piece of code with all relevant parts so I can look at it?

01-29-2004 15:24

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker


procedure tutorial()
int cnum
int speed = 1
int xpos[9]
int ypos[9]
canvas 0
vbl sync on
load images 129
load music 129
play music
sprite off 0
set pen color black
fill rect 0,0 to 750,750
for cnum = 1 to 10
set sprite transparency cnum,0
next cnum
for cnum = 100 to 110
set sprite transparency cnum,0
next cnum
xpos[1] = 3
ypos[1] = 253
xpos[2] = 253
ypos[2] = 103
xpos[3] = 353
ypos[3] = 403
xpos[4] = 604
ypos[4] = 254
set sprite color off 1
set sprite color off 2
set sprite color off 3
set sprite color off 4
set sprite color off 100
set sprite color off 101
set sprite color off 102
set sprite color off 103
set sprite priority 1,1
set sprite priority 2,1 '<---------this is where it stops
.
.
.
end proc




Also, the problem of the other map being shown:


load map 129
set current map 129
open map viewport 1,0,339,23 to 610,276


Shows map 128.

Thanks,
MapMaker

01-29-2004 19:12

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

Ok

Nvem mind about the Map 129/128 part.
I realised that I was useing the same canvas for both maps, and I wasn't clearing off the sprites before switching them. =O

But I'm still stuck on the "set sprite priority - canvas not open" part.

Thanks again,
MapMaker

01-29-2004 22:19

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

The sprite must have been in the inexistent canvas before the canvas was deleted, and so attempts to change its priority result in errors.
What was the current canvas the last time the sprite was called?

01-29-2004 23:12

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

=O

Canvas 1
I never thought of that, ill go check it out

Thanks,
MapMaker

01-29-2004 23:18

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

=D

Ya, I turned off those sprites before I closed the viewport to canvas 1.

It works fine now.

Again Thanks,
MapMaker

01-30-2004 17:32

Posted by:
eric

Location:
earth

Click Here to Email eric   Find more posts by eric

Going back to the map thing, load/unloading the same map in a loop ends up running out of memory.... I used to that alot in C, not releasing memory. Thanks god java has a trash collector, sounds like it is kinda the problem with unloading map.

02-08-2004 19:48

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Yeah I've got the memory leak bug on the todo list.

Cheers,

Mark

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.