The Dink Network

Script question

November 19th 2002, 01:52 PM
peasantmb.gif
Does someone can do something like this?:

void main (void)

{

int &var;

int &wiz;

&crap = 0;

if (&var == 0)

{

//cutscene

&var = 1;

}

}

I just don't wanna waste the 200 global limit with so short cutscenes...
November 19th 2002, 01:54 PM
peasantmb.gif
: Does someone can do something like this?:

: void main (void)

: {

: int &var;

: int &wiz;

: &crap = 0;

: if (&var == 0)

: {

: //cutscene

: &var = 1;

: }

: }

: I just don't wanna waste the 200 global limit with so short cutscenes...

Duh! I meant &var = 0; not &crap = 0;

November 19th 2002, 04:52 PM
wizardg.gif
Paul
Peasant He/Him United States
 
: Does someone can do something like this?:

: void main (void)

: {

: int &var;

: int &wiz;

: &var = 0;

: if (&var == 0)

: {

: //cutscene

: &var = 1;

: }

: }

: I just don't wanna waste the 200 global limit with so short cutscenes...

I'm not sure I understand. Why would you set a variable to 0 and then test if it's 0 right afterwards?

If all you want to do is run the cutscene every time, you don't need a variable or test at all.

November 19th 2002, 06:01 PM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
: : Does someone can do something like this?:

: : void main (void)

: : {

: :   int &var;

: :   int &wiz;

: :   &var = 0;

: :   if (&var == 0)

: :   {

: :     //cutscene

: :     &var = 1;

: :   }

: : }

: : I just don't wanna waste the 200 global limit with so short cutscenes...

: I'm not sure I understand. Why would you set a variable to 0 and then test if it's 0 right afterwards?

: If all you want to do is run the cutscene every time, you don't need a variable or test at all.

i think he wants &var to be global so that the cutscene runs and then &var is 1 and doesnt run anymore. the problem my fine fellow is that int &var creates a local variable, these dont have a 200 limit, but they can only be used inside of this script when it is called. when the script dies, so does the var. you need to make the &var in main.c, and yeah i guess you do have to waste one, that is why people do if &story == 1, if &story > 2, and so on. you can make the cutscene play only if &story < 1 and then use &story for other special things in the future. if you are confused about global and local variables or anything else i just said... or something... ask more and i or someone else will be more specific. cheers.

November 19th 2002, 06:36 PM
fish.gif
There are certain (more complicated, to say the least) ways to do a one-time cutscene without using global.

One is to use vision. I don't like it though since sometimes it gets more confused if you are making a huge epic thing without careful plot.

The other is a "cheating" trick. You can add a small sprite on that screen (a stone or pot or anything that won't do any harm... or you can even shrink it to 1% size to make it disappear... or...). put the cutscene in the main{} of that sprite or use spawn to call the actual cutscene script. (I would recommend the later.) Then before Dink exits this screen, make that sprite disappear! I forgot which editer number it should be, but you should know it.
November 19th 2002, 07:42 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
:the problem my fine fellow is that int &var creates a local variable, these dont have a 200 limit...

Not exactly.

Dink can have 238 active variables at one time, if my memory serves me correctly. This total includes all global variables and all local variables instantiated in all active scripts.