The Dink Network

Sell?

August 27th 2006, 07:49 AM
custom_marpro.png
Marpro
Peasant He/Him bloop
 
I want to make a guy you can sell stuff to, but I dunno why it won't work!
here's the script, the problem is that he ask if I want to sell something but I dont get any options...

void main( void )
{
int &bsword;
int &bcup;
int &bskull;
int &baxe;
int &bbow;
int &bboots;

void hit( void )
{
wait(200);
say_stop_npc("`1Got problems?", ¤t_sprite);
wait(800);
}

void sell(void )
{

sell:

//how many items do they have?

&bsword = count_item("item-sw1");
&bcup = count_item("item-cup");
&bskull = count_item("item-bone");
&baxe; = count_item("item-axe");
&bbow = count_item("item-b1");
&bboots = count_item("item-bt");

choice_start()
set_y 240
set_title_color 1
title_start();
"Anything you want to sell?"
title_end();
(&bsword > 0) "Sell a Longsword - 300g"
(&bcup > 0) "Sell a cup - 5g"
(&bskull > 0) "Sell a skull - 5g"
(&baxe > 0) "Sell an axe - 150g"
(&bbow > 0) "Sell a bow - 150g"
(&bboots > 0) "Sell a pair of boots - 250g"

"Sell nothing"
choice_end()

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

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

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

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

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

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

unfreeze(1);
goto mainloop;
return;

}

}

void talk( void )
{

freeze(1);
choice_start()
set_y 240
set_title_color 1
title_start();
"Hello there. I'm a collector. You can sell stuff to me."
title_end();
"Sell"
"Leave"
choice_end()

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

unfreeze(1);
goto mainloop;
return;

}

August 27th 2006, 08:39 AM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
DinkC Editor found several errors in your script:
Line#1 - Error: Unclosed brackets in void main(void)
Line#95 - Warning: This line is out of any function
Line#27 - Error: Space required after "&baxe"
Line#90 - Warning: Label "mainloop" not found
Line#117 - Warning: Label "mainloop" not found

Instead of goto sell, you can try to use
sell();
but I don't think this will change anything. Try fixing the errors, then see if it works.
August 27th 2006, 01:27 PM
custom_marpro.png
Marpro
Peasant He/Him bloop
 
Ok thanks I'll try that
wierd I counted the brackets... Must have counted wrong
August 27th 2006, 04:05 PM
custom_marpro.png
Marpro
Peasant He/Him bloop
 
Doh! Still won't work
August 27th 2006, 04:29 PM
slayer.gif
MadStalker
Peasant He/Him Finland
tag line 
void main( void )
{
int &bsword;
int &bcup;
int &bskull;
int &baxe;
int &bbow;
int &bboots;
}

void hit( void )
{
wait(200);
say_stop_npc("`1Got problems?", ¤t_sprite);
wait(800);
}

void sell(void )
{

sell:

//how many items do they have?

&bsword = count_item("item-sw1");
&bcup = count_item("item-cup");
&bskull = count_item("item-bone");
&baxe; = count_item("item-axe");
&bbow = count_item("item-b1");
&bboots = count_item("item-bt");

choice_start()
set_y 240
set_title_color 1
title_start();
"Anything you want to sell?"
title_end();
(&bsword > 0) "Sell a Longsword - 300g"
(&bcup > 0) "Sell a cup - 5g"
(&bskull > 0) "Sell a skull - 5g"
(&baxe > 0) "Sell an axe - 150g"
(&bbow > 0) "Sell a bow - 150g"
(&bboots > 0) "Sell a pair of boots - 250g"

"Sell nothing"
choice_end()

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

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

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

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

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

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

unfreeze(1);
goto mainloop;
return;
}

void talk( void )
{
freeze(1);
choice_start()
set_y 240
set_title_color 1
title_start();
"Hello there. I'm a collector. You can sell stuff to me."
title_end();
"Sell"
"Leave"
choice_end()

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

unfreeze(1);
goto mainloop;
return;
}
August 27th 2006, 04:31 PM
slayer.gif
MadStalker
Peasant He/Him Finland
tag line 
It should work like this. I fixed the brackets for ya, you hadn't closed the main proc and the talk proc had one } too many.

Oops, forgot, remove the ; from this line:
&baxe; = count_item("item-axe");
August 27th 2006, 04:39 PM
custom_marpro.png
Marpro
Peasant He/Him bloop
 
I must say I love this site... If you get a problem, there's always someone helping, Madstalker it works PERFECT now! Thanks, and thanks to you too cypry!
August 27th 2006, 04:49 PM
slayer.gif
MadStalker
Peasant He/Him Finland
tag line 
Love to help, you're most welcome

Also you don't probably need those goto mainloop; lines as you don't even have a mainloop: to goto in the entire script!
August 27th 2006, 05:21 PM
knight.gif
Vortex
Peasant He/Him United States
It rubs the lotion on its skin... 
There is also someone always here in case you want to come out of the closet... I am not implying anything...