The Dink Network

Reply to The Wanted Shop Scripts Final Part

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:
 
 
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;

}