The Dink Network

The Wanted Shop Scripts Final Part

August 12th 2002, 02:40 PM
goblinm.gif
// Sample store that buys things

// If you reuse this code, feel free to take out all these comments.

void main( void )

{

//first we need to declare all the variables we'll use for

//counting how many of what dink has.

int &bomb;

int &nut;

int &water;

int &scroll;

int &bonesw;

}

void talk( void )

{

freeze(1);

startok:

//then we need to actually store the number of each item

//dink has in the appropriate variable.

&bomb = count_item("item-bom");

&nut = count_item("item-nut");

&water = count_item("paxwater");

&scroll = count_item("paxscrol");

&bonesw = count_item("paxbone");

//you can change set_y if you need more room for the

//message at the top or more space for items. and you

//can chnage set_title_color if you don'y like orange.

choice_start()

set_y 140

set_title_color 4

title_start();

"Welcome to <store's name here>"

"What do you want to sell?"

title_end();

"Nothing"

(&bomb > 0)"Bomb - $10"

(&nut > 0)"Nut - $1"

(&water > 0)"PaxWater.c - $3"

(&scroll > 0)"PaxScrol.c - $5"

(&bonesw > 0)"PaxBone.c (a sword) - $300"

choice_end()

//normally Dink is allowed to sell things back for half what they cost

//but you don't have to do it that way.

if (&result == 1)

{

unfreeze(1);

return;

}

if (&result == 2)

{

kill_this_item("item-bom");

//kill the item.

&gold += 10;

//add the gold. Very simple.

//Just make sure you give the right amount of gold back.

goto startok;

}

if (&result == 3)

{

kill_this_item("item-nut");

&gold += 1;

goto startok;

}

if (&result == 4)

{

kill_this_item("paxwater");

&gold += 3;

goto startok;

}

if (&result == 5)

{

kill_this_item("paxscrol");

&gold += 5;

goto startok;

}

if (&result == 6)

{

kill_this_item("paxbone");

&gold += 300;

goto startok;

}

say_stop("If Dink says this something is wrong!", 1);

//probaby you have more items in the menu than you have

//blobks of code for handling them.

done:

unfreeze(1);

return;

}
August 12th 2002, 11:18 PM
spike.gif
DS, you're forgetting draw_status! If they have a bomb armed, and then they sell it, the bomb pic will last in the..uhh..Bar, if draw_status(); is not there. It was real amusing putting those for mushrooms in my mod search for the castle of Sardur, as there is at least 20 different mushrooms and each lacked draw_status(); from at least three places.
August 13th 2002, 02:08 PM
wizardb.gif
: DS, you're forgetting draw_status! If they have a bomb armed, and then they sell it, the bomb pic will last in the..uhh..Bar, if draw_status(); is not there. It was real amusing putting those for mushrooms in my mod search for the castle of Sardur, as there is at least 20 different mushrooms and each lacked draw_status(); from at least three places.

Actauly you dont need draw_status();

It should be in the items drop function by default...
August 14th 2002, 05:23 AM
spike.gif
: Actauly you dont need draw_status();

: It should be in the items drop function by default...

Nope, it's there only if you're using an item script from the original Dink as a base.

And there could be a bug, too.. I had it.