The Dink Network

O.K., what's wrong with this script ?

March 6th 2003, 05:28 AM
pq_frog.gif
Ric
Peasant They/Them Canada
 
I'm trying to make an area seem larger than it realy is by having Dink warp to the other side.
void main ()
{
int &wrap;
&wrap=sp_x(1,-1);
if (&wrap < 10)
{
move(1,6,11,0);
}
wait(500);
loop:
&wrap = sp_x(1,-1);
if(&wrap < 20)
{
&player_map += 5;
sp_x(1,595);
load_screen(&player_map);
draw_screen();
return;
}
wait(100);
goto loop;
}
On the other side is the same script, but reversed.
void main ()
{
int &wrap;
&wrap = sp_x(1,-1);
if (&wrap > 590)
{
move(1,4,588,0);
}
wait(500);
loop:
&wrap = sp_x(1,-1);
if (&wrap > 580)
{
&player_map -= 5;
sp_x(1,5);
load_screen(&player_map);
draw_screen();
return;
}
wait(100);
goto loop;
}
But Dink jumps to one screen o.k., then back to the other screen repeatedly...???
March 6th 2003, 06:33 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
If this script is attached to a map, you should kill_this_task(); when done.
If it is attached to a script, you should script_attach(1000); followed by a kill_this_task();
Also, Dink is warped right into the 'sensitive' area on the other screen (when he must warp again) so that could be something.
Maybe it's nice to know, but I wrote a script that makes Dink walk on one screen infinitely (like in Zelda 1 or anything like it) You could be making a 100 screen long cave when you've only got 3 screen left. (It worked with me).
March 6th 2003, 07:07 AM
old.gif
if you want to make a 10 screens long cave, you have to make only 5 screens.

( begin, 3 caves and cave end )

If dink walks to the left ( he needs to walk 10 screens ) if he walks to the right, he exits the cave,

when he walked 10 screens to the left he will exit the cave on the other side.

You need a global int for this, lets call it &caveloop...

Ok

Begin Exit = O
Cave = X
Cave Exit = P

dink needs to reach P

here is a picture:

PXXXXXXXXXXO

but in the editor its
P X X X O
1 2 3 4 5 ( map screen numbers, for example )

then add this script to map screen 2:

void main(void)
{
freeze(1);

if (&caveloop == 10);
{
goto end;
}

script_attach(1000);
&player_map = 3;
load_screen(3);
draw_screen();
&caveloop += 1;
end:
unfreeze(1);
kill_this_task();
}

and add this script to screen 5:

void main(void)
{
&caveloop=0;
kill_this_task();
}

Now, add this script to screen 1:

void main(void)
{
&caveloop=10;
kill_this_task();
}

and this script to screen 4:
void main(void)
{
freeze(1);

if (&caveloop == 0);
{
goto end;
}

script_attach(1000);
&player_map = 3;
load_screen(3);
draw_screen();
&caveloop -= 1;
end:
unfreeze(1);
kill_this_task();
}

editted: sorry, error. Its fixed now
March 6th 2003, 02:25 PM
custom_odd.gif
Ya, i made a gigantic desert with 5 screens in a plus, it's pretty nice.. really simple, just has a lot of different visions, and chooses a random new vision when you walk to another screen, then puts you back in the middle, but you can't see it happen... i liked it
March 7th 2003, 08:51 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Hey, what if you put the scripts for screen 2 and 5 on the begin and the end and check if Dink comes from the middle screen. (sp_x(1,-1); for example, or some global temporary variable).
This means you can use 3 screens!
Just add a vision script to the middle one and change the sprites in the visions.
March 7th 2003, 12:53 PM
custom_odd.gif
The idea is that you use 3 rooms for the looping, but you have one that is different for the beginning, and one different for the end.. after all, you need to get somewhere... so really, the loop does just use three screens