It's me again. Stuck !
Hehe, I got another sell problem... When I select "sell" nothing happens!
All but the sell part works fine. I have changed the for example int &sword; too for example int &aaa so you don't know what things I have in the D-Mod
Please help me !
void main ( void )
{
int &hello = sp_editor_num(¤t_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);
}
All but the sell part works fine. I have changed the for example int &sword; too for example int &aaa so you don't know what things I have in the D-Mod
Please help me !
void main ( void )
{
int &hello = sp_editor_num(¤t_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);
}
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(¤t_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);
}
void main ( void )
{
int &hello = sp_editor_num(¤t_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);
}
Doh! It doesn't work! When I select "sell" nothing happens!
Why don't you use my DinkC Editor? It found the following list of bugs in your script:
Line#114 - Warning: This line is out of any function
Line#116 - Error: Unclosed brackets in void talk(void)
Line#28 - Error: Too few parameters for "say" function
Line#53 - Error: Number required after "set_title_color"
Line#70 - Error: Unknow DinkC command : "x"
Line#77 - Error: Unknow DinkC command : "x"
Line#84 - Error: Unknow DinkC command : "x"
Line#91 - Error: Unknow DinkC command : "x"
Line#98 - Error: Unknow DinkC command : "x"
Line#105 - Error: Unknow DinkC command : "x"
Line#110 - Warning: Label "mainloop" not found
Line#148 - Error: The second operator of the condition must be a number
Line#114 - Warning: This line is out of any function
Line#116 - Error: Unclosed brackets in void talk(void)
Line#28 - Error: Too few parameters for "say" function
Line#53 - Error: Number required after "set_title_color"
Line#70 - Error: Unknow DinkC command : "x"
Line#77 - Error: Unknow DinkC command : "x"
Line#84 - Error: Unknow DinkC command : "x"
Line#91 - Error: Unknow DinkC command : "x"
Line#98 - Error: Unknow DinkC command : "x"
Line#105 - Error: Unknow DinkC command : "x"
Line#110 - Warning: Label "mainloop" not found
Line#148 - Error: The second operator of the condition must be a number
You know what? I like the DinkC editor... but it would be much more useful if the line's number appeared next to it... I get so sick and tired of counting.