wrong
well, i thught patching up my dmod before sending it to the site was a good idea so i decided to fix a thing i had problems with, it's thati usulally made visions for the things they shall say depending on the storyline, so another sprite appeared and said another thing, but now when i did it like this, it didnt work
only the first conversation works!
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&story < 3)
say_stop("Hello, mother", 1);
wait(250);
say_stop("`5hello darling, what about going to johnny?", ¤t_sprite);
wait(250);
say_stop("Great idea! Bye mum!", 1);
wait(250);
say_stop("`5remember to come home for dinner!", ¤t_sprite);
wait(250);
&story = 1;
unfreeze(1);
unfreeze(¤t_sprite);
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&story >= 3);
say_stop("Hi, mother", 1);
wait(250);
say_stop("`5it aint dinner time yet.", ¤t_sprite);
wait(250);
say_stop("uhm... i shall... go, on a picnic, i might not come back on a while", 1);
wait(250);
say_stop("`5Oh, ok.", ¤t_sprite);
wait(250);
unfreeze(1);
unfreeze(¤t_sprite);
}
}
whats wrong?
only the first conversation works!
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&story < 3)
say_stop("Hello, mother", 1);
wait(250);
say_stop("`5hello darling, what about going to johnny?", ¤t_sprite);
wait(250);
say_stop("Great idea! Bye mum!", 1);
wait(250);
say_stop("`5remember to come home for dinner!", ¤t_sprite);
wait(250);
&story = 1;
unfreeze(1);
unfreeze(¤t_sprite);
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&story >= 3);
say_stop("Hi, mother", 1);
wait(250);
say_stop("`5it aint dinner time yet.", ¤t_sprite);
wait(250);
say_stop("uhm... i shall... go, on a picnic, i might not come back on a while", 1);
wait(250);
say_stop("`5Oh, ok.", ¤t_sprite);
wait(250);
unfreeze(1);
unfreeze(¤t_sprite);
}
}
whats wrong?
I don't know what you've done with the sprites and visions but assuming that works correctly, let's look at this script.
You can have only 1 void talk(void) procedure in a script so you should remove one of them and place both conversations in there. Second, you need brackets - { and } - for if-statements as well (if (&story < 3) and (&story >= 3)). Also, you can't have a semicolon (; ) after an if-statement (if (&story == 3); is not allowed). The script should look like (or what I can make of it, the &story = 1; line puzzles me a bit):
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&story < 3)
{
say_stop("Hello, mother", 1);
wait(250);
say_stop("`5hello darling, what about going to johnny?", ¤t_sprite);
wait(250);
say_stop("Great idea! Bye mum!", 1);
wait(250);
say_stop("`5remember to come home for dinner!", ¤t_sprite);
wait(250);
&story = 1;
//?
}
if (&story >= 3)
{
say_stop("Hi, mother", 1);
wait(250);
say_stop("`5it aint dinner time yet.", ¤t_sprite);
wait(250);
say_stop("uhm... i shall... go, on a picnic, i might not come back on a while", 1);
wait(250);
say_stop("`5Oh, ok.", ¤t_sprite);
}
unfreeze(1);
unfreeze(¤t_sprite);
}
You can have only 1 void talk(void) procedure in a script so you should remove one of them and place both conversations in there. Second, you need brackets - { and } - for if-statements as well (if (&story < 3) and (&story >= 3)). Also, you can't have a semicolon (; ) after an if-statement (if (&story == 3); is not allowed). The script should look like (or what I can make of it, the &story = 1; line puzzles me a bit):
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&story < 3)
{
say_stop("Hello, mother", 1);
wait(250);
say_stop("`5hello darling, what about going to johnny?", ¤t_sprite);
wait(250);
say_stop("Great idea! Bye mum!", 1);
wait(250);
say_stop("`5remember to come home for dinner!", ¤t_sprite);
wait(250);
&story = 1;
//?
}
if (&story >= 3)
{
say_stop("Hi, mother", 1);
wait(250);
say_stop("`5it aint dinner time yet.", ¤t_sprite);
wait(250);
say_stop("uhm... i shall... go, on a picnic, i might not come back on a while", 1);
wait(250);
say_stop("`5Oh, ok.", ¤t_sprite);
}
unfreeze(1);
unfreeze(¤t_sprite);
}
another problem, this is the first time i use my own globals something is wrong in the following script, the engine jumps over the first part and then you cant get your spell
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&magic == 0)
{
say_stop("`9Look what I’ve got, Some magic for you, stranger...", ¤t_sprite);
add_magic("item-fb", 437, 1);
wait(200);
say_stop("Great! A fireball spell!", 1);
wait(200);
say_stop("What are you doing in this cave, really?", 1);
wait(200);
say_stop("`9dunno, the author wanted that...", ¤t_sprite);
&magic = 1;
unfreeze(1);
unfreeze(¤t_sprite);
}
if (&magic == 1)
{
say_stop("hello magican", 1);
wait(250);
say_stop("`9hello, did you ever find use for my spell?", ¤t_sprite);
wait(250);
say_stop("truly i did!", 1);
wait(250);
say_stop("`5for a good purpose?", ¤t_sprite);
say_stop("uuh, well... yes... no... uhhhhhh...", 1);
wait(250);
unfreeze(1);
unfreeze(¤t_sprite);
}
}
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&magic == 0)
{
say_stop("`9Look what I’ve got, Some magic for you, stranger...", ¤t_sprite);
add_magic("item-fb", 437, 1);
wait(200);
say_stop("Great! A fireball spell!", 1);
wait(200);
say_stop("What are you doing in this cave, really?", 1);
wait(200);
say_stop("`9dunno, the author wanted that...", ¤t_sprite);
&magic = 1;
unfreeze(1);
unfreeze(¤t_sprite);
}
if (&magic == 1)
{
say_stop("hello magican", 1);
wait(250);
say_stop("`9hello, did you ever find use for my spell?", ¤t_sprite);
wait(250);
say_stop("truly i did!", 1);
wait(250);
say_stop("`5for a good purpose?", ¤t_sprite);
say_stop("uuh, well... yes... no... uhhhhhh...", 1);
wait(250);
unfreeze(1);
unfreeze(¤t_sprite);
}
}
That's because you shouldn't use the global variable &magic - it's used by the engine to store Dink's stats (Attack = &strength, Defense = &defense and Magic = &magic) so you can't use those. So in your case, if Dink's magic level was anything but 0, your script wouldn't work.
So, change the variablename and after you've done that, you also need to change the order of the two if-statements: if (&hasmagic == 1) should be done before (&hasmagic == 0). Because, now the variable is 0, a conversation follows and the variable is 1. Then immediately there's another if-statement to check if it's 1 (which is now the case) so that conversation runs as well which you likely didn't intent to. If you change the order, it won't do that:
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&hasmagic == 1)
{
//code
}
if (&hasmagic == 0)
{
&hasmagic = 1;
}
unfreeze(1);
unfreeze(¤t_sprite);
}
So, change the variablename and after you've done that, you also need to change the order of the two if-statements: if (&hasmagic == 1) should be done before (&hasmagic == 0). Because, now the variable is 0, a conversation follows and the variable is 1. Then immediately there's another if-statement to check if it's 1 (which is now the case) so that conversation runs as well which you likely didn't intent to. If you change the order, it won't do that:
void talk(void)
{
freeze(1);
freeze(¤t_sprite);
if (&hasmagic == 1)
{
//code
}
if (&hasmagic == 0)
{
&hasmagic = 1;
}
unfreeze(1);
unfreeze(¤t_sprite);
}