Could someone look at this script?
In the script below, I have two problems:
1) I don't want the game to fade if Dink chooses not to go to bed, but it does.
2)If Dink takes a nap there will be a fade and the storyline is up to 1, if not the story stays at 0.
I tried to put that in, but the game just chrashed, and I don't know what to do about it. I would be very thankful if someone could show me excactly how this should be written out... I'm just starting to learn this, so excuse this basic question...
THE SCRIPT:
void talk(void)
{
freeze(1);
choice_start();
"Lie down?"
"Nah... Sleep is overrated..."
choice_end();
if(&result==1)
{
fade_down();
fill_screen(0);
say_stop("`4Dink! Wake up!", ¤t_sprite);
wait(200);
&player_map = 33;
sp_x(1, 300);
sp_y(1, 160);
script_attach(1000);
load_screen();
draw_screen();
draw_status();
fade_up();
unfreeze(1);
kill_this_task();
}
return;
}
void hit(void)
{
freeze(1);
say_stop("You're hard!! Soften!", 1);
wait(200);
say_stop("`4In your dreams...", ¤t_sprite);
unfreeze(1);
}
1) I don't want the game to fade if Dink chooses not to go to bed, but it does.
2)If Dink takes a nap there will be a fade and the storyline is up to 1, if not the story stays at 0.
I tried to put that in, but the game just chrashed, and I don't know what to do about it. I would be very thankful if someone could show me excactly how this should be written out... I'm just starting to learn this, so excuse this basic question...
THE SCRIPT:
void talk(void)
{
freeze(1);
choice_start();
"Lie down?"
"Nah... Sleep is overrated..."
choice_end();
if(&result==1)
{
fade_down();
fill_screen(0);
say_stop("`4Dink! Wake up!", ¤t_sprite);
wait(200);
&player_map = 33;
sp_x(1, 300);
sp_y(1, 160);
script_attach(1000);
load_screen();
draw_screen();
draw_status();
fade_up();
unfreeze(1);
kill_this_task();
}
return;
}
void hit(void)
{
freeze(1);
say_stop("You're hard!! Soften!", 1);
wait(200);
say_stop("`4In your dreams...", ¤t_sprite);
unfreeze(1);
}
It could be some spaces in your script that screw it up... Anyway, you should do as below so that Dink is unfreezed if he chooses not to take a nap.
void talk(void)
{
choice_start()
"Lie down?"
"Nah... Sleep is overrated..."
choice_end()
if(&result == 1)
{
freeze(1);
fade_down();
fill_screen(0);
say_stop("`4Dink! Wake up!", ¤t_sprite);
wait(200);
script_attach(1000);
&player_map = 33;
sp_x(1, 300);
sp_y(1, 160);
load_screen();
draw_screen();
draw_status();
fade_up();
unfreeze(1);
kill_this_task();
}
return;
}
void talk(void)
{
choice_start()
"Lie down?"
"Nah... Sleep is overrated..."
choice_end()
if(&result == 1)
{
freeze(1);
fade_down();
fill_screen(0);
say_stop("`4Dink! Wake up!", ¤t_sprite);
wait(200);
script_attach(1000);
&player_map = 33;
sp_x(1, 300);
sp_y(1, 160);
load_screen();
draw_screen();
draw_status();
fade_up();
unfreeze(1);
kill_this_task();
}
return;
}
The spaces are there just to make it easier to read, so they should have nothing to say, at least according to "The Rudiments of scripting". Something else is wrong...
That's not what I mean, I mean the spaces before an { and after if etc.
it's impossible to say if that has anything to do with anything though, as you cannot see the spaces in the posts.
it's impossible to say if that has anything to do with anything though, as you cannot see the spaces in the posts.
Let's say ¬ is a space, then it should look like this:
if¬(&result¬==¬1)
{
//blah
}
spaces before { or } don't matter as far as I know. I don't know for sure if the spaces before and after the == are neccesary, but the one after the if is.
if¬(&result¬==¬1)
{
//blah
}
spaces before { or } don't matter as far as I know. I don't know for sure if the spaces before and after the == are neccesary, but the one after the if is.
Spaces don't matter when setting a variable, but they must be there when comparing a variable.
eg;
&story+=1;
works.
if(&result==1)
no good. Needs a space before and after the '=='.
You might also try a wait(1000); after the fade_up(); I'm not sure, but mabey it kills before it finishes the fade.
eg;
&story+=1;
works.
if(&result==1)
no good. Needs a space before and after the '=='.
You might also try a wait(1000); after the fade_up(); I'm not sure, but mabey it kills before it finishes the fade.