The Dink Network

screen stuff

October 29th 2003, 09:17 AM
duck.gif
Ok, i'll pop the question: I want to do this fade screen thing, en then it fades up in another room. I just don't know how to! Do you have to use &playermap or something?
October 29th 2003, 09:29 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
To warp to another screen with fade up and down, use code like this:

freeze(1)
//other stuff
script_attach(1000);
//use this line to attach the script to 1000, meaning it'll stay in memory when you go to another screen
fade_down();
&player_map = map;
sp_x(1, x);
sp_y(1, y);
sp_dir(1, dir);
//this defines the map screen where Dink will go to (replace map with the mapscreen). Then change x and y into the x and y coordinates where Dink will warp to. Go to the editor and, in DinkEdit, in sprite mode, you can see the x and y coordinates at the bottom of your screen. Then you can also change dir into the direction Dink will be standing (use your numpad for the correct number. 2 is down, 4 is left, 6 is right and 8 is up)
load_screen();
draw_screen();
draw_status();
//load and draw the screen. Draw the statusbars as well.
freeze(1)
//freeze Dink again, Dink unfreezes automatically when you warp to some other screen
fade_up();
wait(300);
//wait command - not required but now it'll wait before moving on with the rest of the script so the screen will be faded up completely.
//other stuff
unfreeze(1)
kill_this_task();
//do a kill_this_task because of the fact that you've attached this script to 1000. This has to be done or the script will stay there.

As an example, this warps Dink to screen 100, x coordinate 200 and y coordinate 300 and he's facing upwards/looking to the north:

freeze(1)
//...
script_attach(1000);
fade_down();
&player_map = 100;
sp_x(1, 200);
sp_y(1, 300);
sp_dir(1, 8);
load_screen();
draw_screen();
draw_status();
freeze(1)
fade_up();
wait(300);
//...
unfreeze(1)
kill_this_task();
October 29th 2003, 10:44 AM
duck.gif
thanks for your help simeon. I've got this other problem. I create a sprite with the screens script ==> create_sprite() but how can attach a script to the created sprite?
October 29th 2003, 10:56 AM
wizardg.gif
Paul
Peasant He/Him United States
 
Like this:
int &junk = create_sprite(<numbers go here> ;
sp_script(&junk, "MyScript");

&junk could be any variable name of course and you only need the "int" if you haven't declared that variable it already. "MyScript" would be the nam of the script file only without the .c at the end. (eg "en-bonc" for "en-bonc.c")

Also, let me point out a couple details on the warp thing:
script_attach(1000);
.
.
.
kill_this_task();

What the script_attach(1000); does is detach the script from the sprite it was attached to, because otherwise, the script is killed when you warp the the next screen and the part after that won't run. But because the script can now run on any screen, you need kill_this_task(); at the end to get rid of it.
October 29th 2003, 11:30 AM
duck.gif
Thanks paul.