The Dink Network

Reply to Re: It's me again. Stuck !

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:
 
 
September 10th 2006, 05:35 PM
slayer.gif
MadStalker
Peasant He/Him Finland
tag line 
Awwww, you use loads of gotos, some of which are unnecessary. You didn't even have a "mainloop:" in the script but you still had a line which would have gotoed it. The script had some bracket errors too. I cleaned up the script for you, and fixed the bracket errors, but I didn't test it. Try this:

void main ( void )
{

int &hello = sp_editor_num(&current_sprite);
int &greet = editor_seq(&hello, -1);

int &aaa;
int &bbb;
int &ccc;
int &ddd;
int &eee;
int &fff;

int &shopman = create_sprite(252,176, 0, 0, 0);

preload_seq(343);
preload_seq(341);

sp_pseq(&shopman, 343);
sp_pframe(&shopman, 1);

int &myrand;

&myrand = random(5, 1);

if (&myrand == 1)
{
say("`%-----------&shopman);
}
if (&myrand == 2)
{
say("`%----------", &shopman);
}

}

void sell(void )
{

sell:

//how many items do they have?

&aaa = count_item("item-aa");
&bbb = count_item("item-bb");
&ccc = count_item("item-cc");
&ddd = count_item("item-dd");
&eee = count_item("item-ee");
&fff = count_item("item-ff");

choice_start()
set_y 240
set_title_color %
title_start();
"------"
title_end();
(&aaa > 0) "Sell a aaa - Xg"
(&bbb > 0) "Sell a bbb - Xg"
(&ccc > 0) "Sell an ccc - Xg"
(&ddd > 0) "Sell a ddd - Xg"
(&eee > 0) "Sell a eee - Xg"
(&fff > 0) "Sell a fff - Xg"

"Sell nothing"
choice_end()

if (&result == 1)
{
kill_this_item("item-aa");
&gold += X;
goto sell;
}

if (&result == 2)
{
kill_this_item("item-bb");
&gold += X;
goto sell;
}

if (&result == 4)
{
kill_this_item("item-cc");
&gold += X;
goto sell;
}

if (&result == 5)
{
kill_this_item("item-dd");
&gold += X;
goto sell;
}

if (&result == 5)
{
kill_this_item("item-ee");
&gold += X;
goto sell;
}

if (&result == 6)
{
kill_this_item("item-ff");
&gold += X;
goto sell;
}

unfreeze(1);
goto mainloop;
return;
}

}

void talk ( void )
{

freeze(1);
freeze(&shopman);

if (&greet == 0)
{
&greet = 1;
editor_seq(&hello, &greet);
say_stop("------", 1);
say_stop("`%----", &shopman);
goto shoploop;
}

shoploop:

choice_start();
set_y 240
set_title_color 5
title_start();
"----------"
title_end();

"ttt- Xg"
"Sell"
"Leave"

choice_end();

if (&result == 1)
{
if (&gold > X)
{
add_item("item-tt", 000, 00);
&gold -= 2000;
say_stop("`%-----", &shopman);
unfreeze(1);
return;
}
else
{
say_stop("`%-------", &shopman);
unfreeze(1);
return;
}

if (&result == 2)
{
goto sell;
}

if (&result == 3)
{
goto done;
}

done:
unfreeze(1);
unfreeze(&shopman);
return;
}

void hit( void )
{
say_stop("`%---------", &shopman);
}