The Dink Network

story problem

June 7th 2005, 08:09 PM
dragon.gif
hey, i got a problem again... my script (below)
that shall higher the story to 2, automaticly runs the second conversation and thats pretty strange, here is the script:
void talk(void)
{
freeze(1)
freeze(¤t_sprite)
if (&story == 0)
{
say_stop("hello, mother", 1);
wait(250);
say_stop("`3hello doll", ¤t_sprite);
wait(250);
say_stop("`3isn't that the sound of the ice-cream-boat?", ¤t_sprite);
wait(250);
say_stop("ice-cream...? ICE-CREAM!!", 1);
wait(250);
say_stop("`3HEY,Calm down!!", ¤t_sprite);
wait(250);
say_stop("i want! i want!", 1);
wait(250);
say_stop("`3okay, here you have some money.", ¤t_sprite);
wait(250);
say_stop("thanks!", 1);
wait(250);
say_stop("`3dont eat so your stomach explodes!", ¤t_sprite);
wait(250);
unfreeze(1)
unfreeze(¤t_sprite)
}
if (&story == 0)
{
&story = 2;
}
if (&story >= 2)
{
say_stop("hi, mom", 1);
wait(250);
say_stop("`3wasnt the ice-cream good?", ¤t_sprite);
wait(250);
say_stop("i havent eated yet", 1);
unfreeze(1);
unfreeze(¤t_sprite);
}
}
to make a sound run, shall you just write in playsound: "sound"
or somthing? and if you want him t get some gold, you write in get_gold 100, or something?
June 7th 2005, 08:53 PM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
You need ; after the freeze stuff.
June 7th 2005, 08:54 PM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
&story problem

Well, it immediately runs the second conversation because story is 2 at that time. Take a look and keep in mind that the script runs from top to bottom:

if (&story == 0)
{
//the first conversation goes here
&story = 2;
}
//so now, &story is 2. The script ain't over yet. It now sees another if-statement, where it checks if &story >= 2. That's the case so it runs this conversation as well.
if (&story >= 2)
{
//second conversation
}

To fix this, you should put the if-statements in reverse order, like this. This way, it won't run the second conversation because the code isn't there. The second time the script runs, it will run because &story is 2 and the second conversation will take place.

if (&story == 2)
{
//second conversation
}
if (&story == 0)
{
//first conversation
&story = 2;
}

Sound

To play a sound, generally you can use (you can change the other numbers, look them up in the DinkC Reference but in most cases, this will suffice):

playsound(xx,22050,0,0,0);

where xx is the number of the sound as defined in start.c. For example, to play the "you have found a secret" sound, do:

playsound(43,22050,0,0,0);

Gold

To give Dink some gold, simple increase the &gold variable (it's a global one):

//gives Dink 100 gold:
&gold += 100;
//decreases Dink's gold:
&gold -= 100;

Edit: some commands, like freeze() and unfreeze(), will function without the semicolon but it's a good habit to put them there.
June 8th 2005, 05:21 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
A good tip is to always check for spelling errors in every new line you add!
There is a special DinkC editor that can check your code for errors, too.
June 8th 2005, 05:25 PM
dragon.gif
well, that editor only make me angry...
it dosen't check WHERE the brackets are, only how many it is , so you can put 12 brackets in the ending and it says it's right.

but where is the spelling error in the script?
June 8th 2005, 05:30 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
Well, not all lines had ;'s. But actually I meant in general

You use Cedit? I don't, but I think the brackets thing works good...