The Dink Network

Reply to Re: story problem

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
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.