The Dink Network

Reply to Re: Talking

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:
 
 
May 7th 2005, 10:58 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
Selling things takes a bit more script as you need to check if people have enough cash, enough room in their inventory and such. A working sell script would be:

void talk(void)
{
freeze(1)
freeze(&current_sprite)
choice_start()
set_y 240
set_title_color 5
title_start();
Shop Text

Blaaa
title_end();
"Buy elixer for 100 gold"
"Leave"
choice_end()
wait(300);

if (&result == 1)
{
if (&gold < 100)
{
say_stop("`5Sorry, not enough gold..", &current_sprite);
goto leave;
}
int &junk = free_items();
if (&junk < 1)
{
say_stop("`5Sorry, you're carrying too much", &current_sprite);
goto leave;
}
add_item("item-eli",438,9);
&gold -= 100;
}

leave:
unfreeze(&current_sprite)
unfreeze(1)
}

But then, usually your shop has a guy behind the counter so it's slightly different because not the &current_sprite would be talking/selling but a sprite behind the counter. I'd say look at some salescripts from the original game, they can be found in the develop directory in the source.zip file.