Reply to The Wanted Shop Scripts Part 1
If you don't have an account, just leave the password field blank.
// Sample store that sells things
// If you reuse this code, feel free to take out all these comments.
void main( void )
{
int &junk;
}
void talk( void )
{
freeze(1);
startok:
//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 buy?"
title_end();
"Nothing"
"Bomb - $20"
"Nut - $2"
"PaxWater.c - $5"
"PaxScrol.c - $10"
"PaxBone.c (a sword) - $600"
choice_end()
if (&result == 1)
{
unfreeze(1);
return;
}
//They didn't exit, and whatever they're buying will need a free
//space in their inventory. So we'll stop them if they don't have one.
&junk = free_items();
if (&junk == 0)
{
say("Oops, my backpack is full.", 1);
goto done;
}
// if &result is 2, that's the FIRST item, because leave is choice #1.
// this is a normal bomb, straight from Dink.
if (&result == 2)
{
// even though the price is on the menu above, we need to use it again
// right here / to check if they have enough
if (&gold < 20)
goto poor;
&gold -= 20;
// and here/ to take the money away. Make sure all three numbers are the same.
add_item("item-bom",438, 3);
// | | |
// '------|---|----thats the name if the script for the item.
// | | Note: Don't put .c or .d on it.
// '---|----thats the sequence to get the graphic from.
// '----And thats the spesific graphic in the sequence.
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
goto startok;
}
// this is a normal alk tree nut, straight from Dink.
if (&result == 3)
{
if (&gold < 2)
goto poor;
&gold -= 2;
add_item("item-nut",438, 19);
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
goto startok;
}
//PaxWater.c is a new item. It's bottle of water.
//it makes a good template for any item that get's used up.
if (&result == 4)
{
if (&gold < 5)
goto poor;
&gold -= 5;
add_item("paxwater", 438, 11);
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
goto startok;
}
//PaxScrol.c is a new item. It's scroll with a stupid message on it.
//it makes a good template for any item that can be re-used.
if (&result == 5)
{
if (&gold < 10)
goto poor;
&gold -= 10;
add_item("paxscrol",438, 16);
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
goto startok;
}
//PaxBone.c is a new item. It's bone sword.
//it makes a good template for any melee (non-ranged) weapon.
if (&result == 6)
{
if (&gold < 600)
goto poor;
&gold -= 600;
add_item("paxbone",438, 18);
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
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.
poor:
say("Oops, I can't pay for that.", 1);
goto done;
done:
unfreeze(1);
return;
}
// If you reuse this code, feel free to take out all these comments.
void main( void )
{
int &junk;
}
void talk( void )
{
freeze(1);
startok:
//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 buy?"
title_end();
"Nothing"
"Bomb - $20"
"Nut - $2"
"PaxWater.c - $5"
"PaxScrol.c - $10"
"PaxBone.c (a sword) - $600"
choice_end()
if (&result == 1)
{
unfreeze(1);
return;
}
//They didn't exit, and whatever they're buying will need a free
//space in their inventory. So we'll stop them if they don't have one.
&junk = free_items();
if (&junk == 0)
{
say("Oops, my backpack is full.", 1);
goto done;
}
// if &result is 2, that's the FIRST item, because leave is choice #1.
// this is a normal bomb, straight from Dink.
if (&result == 2)
{
// even though the price is on the menu above, we need to use it again
// right here / to check if they have enough
if (&gold < 20)
goto poor;
&gold -= 20;
// and here/ to take the money away. Make sure all three numbers are the same.
add_item("item-bom",438, 3);
// | | |
// '------|---|----thats the name if the script for the item.
// | | Note: Don't put .c or .d on it.
// '---|----thats the sequence to get the graphic from.
// '----And thats the spesific graphic in the sequence.
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
goto startok;
}
// this is a normal alk tree nut, straight from Dink.
if (&result == 3)
{
if (&gold < 2)
goto poor;
&gold -= 2;
add_item("item-nut",438, 19);
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
goto startok;
}
//PaxWater.c is a new item. It's bottle of water.
//it makes a good template for any item that get's used up.
if (&result == 4)
{
if (&gold < 5)
goto poor;
&gold -= 5;
add_item("paxwater", 438, 11);
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
goto startok;
}
//PaxScrol.c is a new item. It's scroll with a stupid message on it.
//it makes a good template for any item that can be re-used.
if (&result == 5)
{
if (&gold < 10)
goto poor;
&gold -= 10;
add_item("paxscrol",438, 16);
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
goto startok;
}
//PaxBone.c is a new item. It's bone sword.
//it makes a good template for any melee (non-ranged) weapon.
if (&result == 6)
{
if (&gold < 600)
goto poor;
&gold -= 600;
add_item("paxbone",438, 18);
playsound(10,22050,0,0,0);
//"SWORD2.WAV" (The Get Item Noise)
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.
poor:
say("Oops, I can't pay for that.", 1);
goto done;
done:
unfreeze(1);
return;
}






