The Dink Network

Mkbul's code error thread

March 13th 2010, 04:10 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Ok, i decided to make a thread for my code problems.

Here is my #1.

void main( void )
{
	playmidi("ticket.mid");
	sp_speed(&current_sprite, 2);
	sp_base_walk(&current_sprite, 370);
	sp_brain(&current_sprite, 16);
}

void talk( void )
{
	freeze(1);
	freeze(&current_sprite);
	say_stop("Hi there!", 1);
	wait(100);
	
	choice:
	choice_start()

	set_y 240
	set_title_color 10

	title_start()
	What is that you want here?
	title_end()
	if (&story == 4) "I read a note"
	"What are you doing here?"
	"You seem not ok"
	"Forget it"

	choice_end()
	
	if (&result = 1)
	{	
		say_stop("I've found a note on a cavern that opened from the earthquake!", 1);
		wait(100);
		say_stop("`0Oh really?", &current_sprite);
		wait(100);
		say_stop("`0I guess you want something from me now", &current_sprite);
		wait(100);
		say_stop("Yeah...", 1);
		wait(100);
		
		if (&lady_vesti == 2)
		{
				say_stop("`0Go save my wife first, and then tell me!", &current_sprite);
	
		}
		
		if (&lady_vesti > 2)
		{
		say_stop("`0Ok, what do you want?", &current_sprite);
		wait(100);
		say_stop("Im suspecting that Island of Icrotie has a passage to this hell...", 1);
		wait(100);
		say_stop("`0But that turned into Wasteland years ago!", &current_sprite);
		wait(100);
		say_stop("Just send me there!", 1);
		wait(100);
		say_stop("`0Not so fast, bring me some firefist gloves first!", &current_sprite);
		wait(100);
		say_stop("Crap...another adventure", 1);
		unfreeze(1);
		unfreeze(&current_sprite);

		if (&fire_gloves = 0)
		{
			say("`0Get me those gloves!", &current_sprite);
		} 
		else
		{
		say_stop("I got you the gloves!", 1);
		wait(100);
		say_stop("`0Thank you man!", &current_sprite);
		wait(100);
		say_stop("`0Now, let's get to work", &current_sprite);
		wait(100);
		goto warp;

		}

	}
	
	if (&result == 2)
	{
		say_stop("What are you doing here?", 1);
		wait(100);
		say_stop("`0I just wanted to leave from the buzy village above", &current_sprite);
		wait(100);
		say_stop("`0With all those taxes", &current_sprite);
		wait(100);
		say_stop("Yeah, the Giff is very selfish", 1);
		wait(100);
		say_stop("`0Basicly i argued with Mr. Pua", &current_sprite);
		wait(100);
		goto choice;
	}
	if (&result == 3)
	{
		say_stop("You don't seem very well, what's wrong?", 1);
		wait(100);
		say_stop("`0Well, my wife has gone to make some potions", &current_sprite);
		wait(100);
		say_stop("`0And she hasn't returned yet...", &current_sprite);
		wait(100);
		say_stop("I think i know where to go...", 1);
		wait(100);
		say_stop("`0Really? Thank you...eeerm your name?", &current_sprite);
		wait(100);
		say_stop("Dink Smallwood", 1);
		&lady_vesti += 1;
		goto choice;

	}
	if (&result == 4)
	{
		unfreeze(1);
		unfreeze(&current_sprite);
	}
		
		warp:
		
		fade_down();
		&player_map = 5;
		sp_x(1, 145);
		sp_y(1, 90);
		load_screen(5);
		draw_screen();
		fade_up();
		
		
}


The choice works really well, but whichever choice i choose it crashes...can you tell me why?
March 13th 2010, 04:53 AM
peasantmb.gif
YeOldeToasT
Peasant Australia steam
discord.gg/Ukugfbh 
The choice works really well, but whichever choice i choose it crashes

That does not make sense. If it works really well, then it wouldn't crash.

Also, you're deviating from one equals sign = to two == and back again when checking variable value. I didn't know you could do that. Leave it at two. ==

In your choices, the first one, take out the "if". That's probably what's causing it to sht a brick. It's not needed, and the syntax completely changes otherwise.

Otherwise, it's because you've left off the semicolons ;;; on choice_start etc.
March 13th 2010, 05:10 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
I mean that the choice thingy opens and functions, but it crashes when i select something
March 13th 2010, 07:34 AM
dragon.gif
Quiztis
Peasant Male Sweden steam bloop
Life? What's that? Can I download it?! 
Check your brackets and try again. There's one that's not closed.
March 13th 2010, 08:35 AM
custom_robj.png
Robj
Peasant Male Australia
You feed the madness, and it feeds on you. 
Below is a copy of the script, all the errors I could see have been fixed.
- Remember to always use two equal signs when checking a variable (for if statements).
- When checking a variable within a choice command you do not add if, you just use the brackets.
- The choice start and end lines should have semicolons after them, as should the title start and end lines.
- The if (&lady_vesti > 2) had an open bracket, but was not closed.
See fixed script below.

void main( void )
{
	playmidi("ticket.mid");
	sp_speed(&current_sprite, 2);
	sp_base_walk(&current_sprite, 370);
	sp_brain(&current_sprite, 16);
}

void talk( void )
{
	freeze(1);
	freeze(&current_sprite);
	say_stop("Hi there!", 1);
	wait(100);
	
	choice:
	choice_start();

	set_y 240
	set_title_color 10

	title_start();
	What is that you want here?
	title_end();
	(&story == 4) "I read a note"
	"What are you doing here?"
	"You seem not ok"
	"Forget it"

	choice_end();
	
	if (&result == 1)
	{	
		say_stop("I've found a note on a cavern that opened from the earthquake!", 1);
		wait(100);
		say_stop("`0Oh really?", &current_sprite);
		wait(100);
		say_stop("`0I guess you want something from me now", &current_sprite);
		wait(100);
		say_stop("Yeah...", 1);
		wait(100);
		
		if (&lady_vesti == 2)
		{
				say_stop("`0Go save my wife first, and then tell me!", &current_sprite);
	
		}
		
		if (&lady_vesti > 2)
		{
		say_stop("`0Ok, what do you want?", &current_sprite);
		wait(100);
		say_stop("Im suspecting that Island of Icrotie has a passage to this hell...", 1);
		wait(100);
		say_stop("`0But that turned into Wasteland years ago!", &current_sprite);
		wait(100);
		say_stop("Just send me there!", 1);
		wait(100);
		say_stop("`0Not so fast, bring me some firefist gloves first!", &current_sprite);
		wait(100);
		say_stop("Crap...another adventure", 1);
		unfreeze(1);
		unfreeze(&current_sprite);

		if (&fire_gloves == 0)
		{
			say("`0Get me those gloves!", &current_sprite);
		} 
		else
		{
		say_stop("I got you the gloves!", 1);
		wait(100);
		say_stop("`0Thank you man!", &current_sprite);
		wait(100);
		say_stop("`0Now, let's get to work", &current_sprite);
		wait(100);
		goto warp;
        }
		}

	}
	
	if (&result == 2)
	{
		say_stop("What are you doing here?", 1);
		wait(100);
		say_stop("`0I just wanted to leave from the buzy village above", &current_sprite);
		wait(100);
		say_stop("`0With all those taxes", &current_sprite);
		wait(100);
		say_stop("Yeah, the Giff is very selfish", 1);
		wait(100);
		say_stop("`0Basicly i argued with Mr. Pua", &current_sprite);
		wait(100);
		goto choice;
	}
	if (&result == 3)
	{
		say_stop("You don't seem very well, what's wrong?", 1);
		wait(100);
		say_stop("`0Well, my wife has gone to make some potions", &current_sprite);
		wait(100);
		say_stop("`0And she hasn't returned yet...", &current_sprite);
		wait(100);
		say_stop("I think i know where to go...", 1);
		wait(100);
		say_stop("`0Really? Thank you...eeerm your name?", &current_sprite);
		wait(100);
		say_stop("Dink Smallwood", 1);
		&lady_vesti += 1;
		goto choice;

	}
	if (&result == 4)
	{
		unfreeze(1);
		unfreeze(&current_sprite);
	}
		
		warp:
		
		fade_down();
		&player_map = 5;
		sp_x(1, 145);
		sp_y(1, 90);
		load_screen(5);
		draw_screen();
		fade_up();
		
		
}
March 13th 2010, 09:38 AM
spike.gif
scratcher
Bard Male Finland bloop
cigarette bonca 
A lot of errors, but weird that it should crash... Must be the "if " in the choice menu, or possibly the space between "Forget it" and choice_end()?

Semicolons aren't really needed, though. Ever.
March 24th 2010, 06:22 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
So, i have this code:

void main(void)
{
sp_touch_damage(&current_sprite, -1);
}

void touch(void)
{
sp_touch_damage(&current_sprite, 0);
sound:
int &crap = random(10, 1);
if (&crap == 5)
{
playsound(35, 17000, 0, 0, 0);
}
wait(10);
goto sound;
}

you pretty much understood what i want to do...i want it to play a sound everyonce in a while... but it does not work, any help?
March 24th 2010, 08:14 AM
wizardb.gif
Kyle
Peasant Male Belgium
 
You're declaring &crap in a single line every time, that doesn't work. Change int &crap = random(10, 1) into:
int &crap;
&crap = random(10, 1);

And for the sake of clean code, put the int &crap above the start of the loop Also, I assume the goal you're after is that once the sprite has been touched once, the sound starts playing randomly forever right? Not just randomly on each touch? Cause then you need to change more stuff around
March 24th 2010, 08:46 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
It still doesn't work...lemme show you the new code:

void main(void)
{
sp_touch_damage(&current_sprite, -1);
}

void touch(void)
{
external("sink", "sink");
int &crap;
&crap = random(10,1);
int &hertz;
&hertz = random(15000, 18000);
if (&crap == 5)
{
playsound(35, &hertz, 0,0, 0);
}
wait(100000);
sp_touch_damage(&current_sprite, 0);
}

March 24th 2010, 09:18 AM
dinkdead.gif
Did you mean to get rid of the loop? That now has a 1 in 10 chance of playing the sound, and it will only play it once even then. The minute wait seems a bit pointless too if all that happens afterwards is disabling the touch.

Also, there's no need for the &hertz thing because playsound has a built-in random speed setting. Just do this: playsound(35, 15000, 3000, 0, 0);

Tell us what you want to do and maybe we can advise better! Like how long is the sound and how often should it play? In your first loop you're checking a 1 in 10 chance 100 times a second, that will play the sound very very often
March 24th 2010, 09:26 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Remember fiat's, sinking in water when getting to close the water machine? thats how
March 24th 2010, 09:29 AM
wizardb.gif
Kyle
Peasant Male Belgium
 
No, I played that in the Middle Ages, so I don't remember

Explain what you'd like to achieve
March 24th 2010, 09:32 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
I want dink to play the sinking animation & play the sound...uhhh that sounded about 2 to 3 times per second.
March 24th 2010, 09:41 AM
knightgl.gif
castman
Peasant Male Brazil
Some day I'll finish my mod... Some day... 
Maybe this?

Randomly play sound:
void main(void)
{
sp_touch_damage(&current_sprite, -1);
}

void touch(void)
{
sp_touch_damage(&current_sprite, 0);
int &crap;

sound:
&crap = random(4, 1);

if (&crap == 5)
{
playsound(35, 17000, 2000, 0, 0);
}
wait(100);
goto sound;
}
The random will run 10 times per second with a chance of 1 : 5, so, probably, it will sound about 2 or 3 times per second, or not

Random wait time
void main(void)
{
sp_touch_damage(&current_sprite, -1);
}

void touch(void)
{
int &crap;
sp_touch_damage(&current_sprite, 0);

sound:

playsound(35, 17000, 2000, 0, 0);

&crap = random(300, 100);

wait(&crap);
goto sound;
}


The randomised wait timer will surely play the sound with a defined wait minimum time, and you can add the varial as you wish ^^
March 24th 2010, 09:52 AM
wizardb.gif
Kyle
Peasant Male Belgium
 
That sounds like it would work. But, make sure there's nothing going on in the external you're calling that might make it skip the rest or never get there.
March 24th 2010, 10:49 AM
dinkdead.gif
Oh that... I've used that in a D-Mod I'm making but it took quite a bit of tweaking to make the graphics work IIRC, not sure about the sound. I'll look it up a bit later when I have time if you like to see if it'll help.
March 24th 2010, 12:38 PM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Sparrowhawk, that is cool and thanks...by the way external just loads the ini lines

init("PATH");

etc
March 25th 2010, 01:17 AM
dinkdead.gif
Are you using Redink's script? Because that bit is basically the same as what you put above:

&count = random(10,1);
if (&count == 5)
{
  playsound(35, 16000, 0, 0, 0);
  spawn("splash");
  //that just makes the splash graphics
}
wait(100);


So I'm not sure why your sound doesn't work unless there's something wrong with the sound itself... does it work when not in this loop?
Or perhaps the script is going wrong somewhere else - there are 5 or 6 different loops in it to get tangled up

To do that walking through water I think all you need to edit is the x/y positions of where Dink actually enters the water and it should work fine.
March 25th 2010, 02:16 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Basicly, i'm not using redink's script, even if that will be an easy way... im just using invinsible things to make that when you touch them to hear that splash thingy and play the inwater dink animation...

Im not sure why it doesnt work, everything is right as far as i know.
March 25th 2010, 07:47 AM
dinkdead.gif
It's worth a try doing it in a different script rather than in the touch procedure. Or a different part of the same script. Make a new global, for example &splashing, and try this:

void main (void)
{
  int &crap;
  sp_touch_damage(&current_sprite, -1);
}

void touch (void)
{
  if (&splashing == 0)
  {
    goto startsplash;
  }
}

void splash (void)
{
startsplash:
  &splashing = 1;
  //changing this variable makes sure that you won't start several loops running at the same time
  //change your graphics (init) etc here too
loop:
  &crap = random(10, 1);
  if (&crap == 5)
  {
    playsound(35, 17000, 0, 0, 0);
  }
  wait(100);
  if (&splashing == 1)
  {
    goto loop;
  }
  //change the graphics back to normal here
}


Doing it like this means you would need another sprite at the edge of the water to turn the global back to 0 so the splashing effect stops. Just this would do:

void main (void)
{
  sp_touch_damage(&current_sprite, -1);
}
void touch (void)
{
  &splashing = 0;
}
March 25th 2010, 08:44 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Very interesting, wish i had time to study more DinkC
March 25th 2010, 09:07 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
But...it still deosnt work....
March 25th 2010, 10:48 AM
slayer.gif
rabidwolf9
Peasant Male United States steam
twitch.tv/rabidwolf9 
" im just using invinsible things to make that when you touch them to hear that splash thingy and play the inwater dink animation..."

You're using invisible things as in type 2 sprites? If so, invisible sprites can't have scripts. You'd need to change it back to type 1 and use sp_nodraw(&current_sprite,1) in your script.
March 25th 2010, 10:58 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
The script now is:

void main(void)
{
  int &wait;
  int &crap;
  sp_touch_damage(&current_sprite, -1);
  sp_nodraw(&current_sprite, 1);
}

void touch(void)
{
  sp_touch_damage(&current_sprite, 0);
  if (&splashing == 0)
    {
    goto startsplash;
    }
}

void splash(void)

{
  startsplash:
  &splashing = 1;
 init("load_sequence_now graphics\dink\water\ds-i2- 12 250 33 70 -12 -9 12 9"); 
init("load_sequence_now graphics\dink\water\ds-i4- 14 250 30 71 -11 -9 11 9");
init("load_sequence_now graphics\dink\water\ds-i6- 16 250 36 70 -11 -9 11 9"); 
init("load_sequence_now graphics\dink\water\ds-i8- 18 250 32 68 -12 -9 12 9");

init("load_sequence_now graphics\dink\water\ds-w1- 71 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\water\ds-w2- 72 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\water\ds-w3- 73 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\water\ds-w4- 74 43 38 72 -12 -9 12 9");
init("load_sequence_now graphics\dink\water\ds-w6- 76 43 38 72 -13 -9 13 9");
init("load_sequence_now graphics\dink\water\ds-w7- 77 43 38 72 -12 -10 12 10");
init("load_sequence_now graphics\dink\water\ds-w8- 78 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\water\ds-w9- 79 43 38 72 -14 -9 14 9");
 external("sink", "sink"); 
  loop:
  &crap = random(10,1);
   if (&crap == 3)
    {
     playsound(35, 17000, 0, 0, 0); 
    }
    wait(100);
    if (&splashing == 1)
    {
      goto loop;
    }
      external("sink", "outwater");
init("load_sequence_now graphics\dink\idle\ds-i2- 12 250 33 70 -12 -9 12 9"); 
init("load_sequence_now graphics\dink\idle\ds-i4- 14 250 30 71 -11 -9 11 9");
init("load_sequence_now graphics\dink\idle\ds-i6- 16 250 36 70 -11 -9 11 9"); 
init("load_sequence_now graphics\dink\idle\ds-i8- 18 250 32 68 -12 -9 12 9");

init("load_sequence_now graphics\dink\walk\ds-w1- 71 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\walk\ds-w2- 72 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w3- 73 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\walk\ds-w4- 74 43 38 72 -12 -9 12 9");
init("load_sequence_now graphics\dink\walk\ds-w6- 76 43 38 72 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w7- 77 43 38 72 -12 -10 12 10");
init("load_sequence_now graphics\dink\walk\ds-w8- 78 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w9- 79 43 38 72 -14 -9 14 9");
}


It plays the sound, however dink is not inwater!
March 25th 2010, 01:12 PM
dinkdead.gif
This might be a stupid question, but did you put the graphics in your D-Mod folder?

Also, you said before that the external was for the inits but now you have them in that script, no need for the external now...?
March 25th 2010, 01:45 PM
knightgl.gif
castman
Peasant Male Brazil
Some day I'll finish my mod... Some day... 
It plays the sound, however dink is not inwater!

Once the script reaches line 14 it goes to line 21, and then &splashing becomes 1

At line 41 the sound is played and after line 46 it returns to 37.

Unless you place a sprite with a script changing &splashing 1 into 0, the loop will keep running, and the sound playing.

I hope I'm not saying crap, I think you should surround the water with sprites scripted to change the &splashing varial, or this script will never reach line 48 and call the external procedure

EDIT: Sparrowhawk already said that and made an example script

void main (void)
{
  sp_nodraw(&current_sprite, 1);
  sp_touch_damage(&current_sprite, -1);
}
void touch (void)
{
  &splashing = 0;
}


I've just add the sp_nodraw, so this sprite will be invisible without setting 'invible' on editor.
March 25th 2010, 02:34 PM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
yeah, i just thought i would call them twice to avoud problems...graphics are in my dmod/graphics dir...I just dont get what is wrong
March 27th 2010, 02:57 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Bump...please anyone?
March 27th 2010, 04:35 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Ok guys, new problem came to surface!

void main(void)
{
	int &var;
	&var = create_sprite(164, 100, 0, 341, 1);
}

void talk(void)
{
	int &junk = free_items();
	freeze(1);
	choice:
	choice_start()

	set_y 240
	set_title_color 9

	title_start()
	Welcome to my store
	title_end()

	"Ask About The Store"
	"Ask About him"
	"Ask About the Earthquake"
	"See what's for sale"
	"Nevermind"
	(&story == 4) "Can you make a siege gun?"

	choice_end()

	If (&result ==  1)
	{
		say_stop("`8Well, i'm taking shipmets of swords from the south", &var);
		say_stop("`8But now with this god dang earthquake", &var);
		say_stop("`8I cant get shipments", &var);
		goto choice;
	}

	If (&result ==  2)
	{
		say_stop("`8My name is Alex Pua", &var);
		say_stop("Hrumph", 1);
		say_stop("`8Do not laugh please", &var);
		say_stop("`8I come from England", &var);
		say_stop("How did you get here?", 1);
		say_stop("`8I got here because i thought i'd found more customers", &var);
		goto choice;
	}

	If (&result ==  3)
	{
		say_stop("`8It striked suddently as most earthquakes", &var);
		say_stop("`8It was gigantic", &current_sprite);
		say_stop("`8Even there was lava blowing out south of my house!", &var);
		say_stop("Were there any victrims?", 1);
		say_stop("`8Yea...a house north fo here collapsed", &var);
		say_stop("`8Leaving Mary and here husband dead...", &var);
		say_stop("I'm Sorry", 1);
		goto choice;
	}

	If (&result ==  4)
	{
		
		choice_start();

		set_y 240
		set_title_color 9

		title_start();
		I've got some stuff for you
		title_end();

		"Longsword -- 400"
		"Clawsword -- 1000"
		"No Thanks"

		choice_end();

		If (&result ==  1)
		{
			if (&junk < 1)
			{		choice_start();

		set_y 240
		set_title_color 9

		title_start();
I don't have any room in my backpack
		title_end();
		"Ok"
		choice_end();
		if (&result == 1)
				{
				unfreeze(1);
				}	

			}
			
			if (&gold < 400)
			{
				
				choice_start();

				set_y 240
				set_title_color 9

				title_start();
				I dont have enough money
				title_end();

				"Ok"

				choice_end();
				if (&result == 1)
				{
				unfreeze(1);
				}	
				&gold -= 400;
				add_item("item-sw1", 438, 7);

			}
		}

		If (&result ==  2)
		{
						if (&junk < 1)
			{		choice_start();

		set_y 240
		set_title_color 9

		title_start();
I don't have any room in my backpack
		title_end();
		"Ok"
		choice_end();
		if (&result == 1)
				{
				unfreeze(1);
				}	

			}
			
			if (&gold < 1000)
			{
				
				choice_start();

				set_y 240
				set_title_color 9

				title_start();
				I dont have enough money
				title_end();

				"Ok"

				choice_end();
				if (&result == 1)
				{
				unfreeze(1);
				}	
				&gold -= 1000;
				add_item("item-sw2", 438, 23);

		}

		If (&result ==  3)
		{
			unfreeze(1);
		}

	}

	If (&result ==  5)
	{
			unfreeze(1);
	}

	If (&result ==  6)
	{
			say_stop("`8Are you nuts?", &var);
			say_stop("`8It needs at least a thousand pieces of gold!", &var);
			say_stop("Perhaps i could find the gold!", 1);
			&story += 1;
			goto choice;
	}

	
}

void hit(void)

{
	int &crap = random(5,1);
	if(&crap == 1)
	{
		say("`@Stop Hitting my bench!", &var);
	}
	if(&crap == 2)
	{
		say("`@Go away!", &var);
	}
	if(&crap == 3)
	{
		say("`@Are you nuts?", &var);
	}
	if(&crap == 4)
	{
		say("`@This sword will get in your chest!", &var);
	}
	if(&crap == 5)
	{
		say("`@Is your skull empty?", &var);
	}
}


When i try to buy something, there are three possible things that should happen:

~ Crash
~ Give the sword & the money you needed for it
~ Stay Freezed

PLEASE HELP !
March 27th 2010, 05:34 PM
dinkdead.gif
Line 82, the choice is on the same line as the bracket:
if (&junk < 1)
  {       choice_start();


After saying "you don't have enough money" it will take the gold and give him the sword anyway...

Lay it out roughly like this:
choice_start();
"longsword"
"clawsword"
"nothing"
if (&result == 1)
{
  if (&junk < 1)
  {
    //say not enough space
    goto skip;
  }
  if (&gold < 400)
  {
    //say not enough gold
    goto skip;
  }
  //take gold and give dink the sword here
}
if (&result == 2)
{
  //same as longsword
}
skip:
  unfreeze(1);


And by the way, I tried your other script with walking through the water... I just made a blank D-Mod, added the graphics from FIAT, made a river with two lines of benches at the edge (inner line with the water script and outer line just changing &splashing to 0) and it works fine! The only change I made was taking out the externals.
March 28th 2010, 02:42 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
I do not get it, is my d-mod cursed? Why everything doesnt work lol...anyways, let me try the one with the water now. Weaponary didnt work
March 28th 2010, 07:00 AM
dinkdead.gif
Ok this should work

void main(void)
{
	int &var;
	int &junk;
	&var = create_sprite(164, 100, 0, 341, 1);
}

void talk(void)
{
	&junk = free_items();
	freeze(1);
choice:
	choice_start();

	set_y 240
	set_title_color 9

	title_start();
	Welcome to my store
	title_end();

	"Ask About The Store"
	"Ask About him"
	"Ask About the Earthquake"
	"See what's for sale"
	"Nevermind"
	(&story == 4) "Can you make a siege gun?"

	choice_end();

	if (&result ==  1)
	{
		say_stop("`8Well, I'm taking shipments of swords from the south", &var);
		say_stop("`8But now with this god dang earthquake", &var);
		say_stop("`8I can't get shipments", &var);
		goto choice;
	}

	if (&result == 2)
	{
		say_stop("`8My name is Alex Pua", &var);
		say_stop("Hrumph", 1);
		say_stop("`8Do not laugh please", &var);
		say_stop("`8I come from England", &var);
		say_stop("How did you get here?", 1);
		say_stop("`8I got here because I thought I'd find more customers", &var);
		goto choice;
	}

	if (&result == 3)
	{
		say_stop("`8It struck suddenly like most earthquakes", &var);
		say_stop("`8It was gigantic", &var);
		say_stop("`8There was even lava blowing out south of my house!", &var);
		say_stop("Were there any victims?", 1);
		say_stop("`8Yea...a house north of here collapsed", &var);
		say_stop("`8Leaving Mary and her husband dead...", &var);
		say_stop("I'm sorry", 1);
		goto choice;
	}

	if (&result == 4)
	{
	rechoose:
		choice_start();

		set_y 240
		set_title_color 9

		title_start();
		I've got some stuff for you
		title_end();

		"Longsword -- 400"
		"Clawsword -- 1000"
		"No Thanks"

		choice_end();

		if (&result ==  1)
		{
			if (&junk < 1)
			{
				choice_start();

				set_y 240
				set_title_color 9

				title_start();
				I don't have any room in my backpack
				title_end();
				"Ok"
				choice_end();
				goto rechoose;
			}
			
			if (&gold < 400)
			{
				
				choice_start();

				set_y 240
				set_title_color 9

				title_start();
				I dont have enough money
				title_end();
				"Ok"
				choice_end();
				goto rechoose;
			}

			&gold -= 400;
			add_item("item-sw1", 438, 7);
		}

		if (&result ==  2)
		{
			if (&junk < 1)
			{
				choice_start();

				set_y 240
				set_title_color 9

				title_start();
				I don't have any room in my backpack
				title_end();
				"Ok"
				choice_end();
				goto rechoose;
			}
			
			if (&gold < 1000)
			{
				
				choice_start();

				set_y 240
				set_title_color 9

				title_start();
				I dont have enough money
				title_end();

				"Ok"

				choice_end();
				goto rechoose;
			}
			&gold -= 1000;
			add_item("item-sw2", 438, 23);
		}
	}

	if (&result ==  6)
	{
		say_stop("`8Are you nuts?", &var);
		say_stop("`8It needs at least a thousand pieces of gold!", &var);
		say_stop("Perhaps I could find the gold!", 1);
		&story += 1;
		goto choice;
	}

	unfreeze(1);
}

void hit(void)

{
	//No need for two variables - can use &junk for both!
	//And he says this in yellow... I guess you changed this colour somewhere?
	&junk = random(5,1);
	if(&junk == 1)
	{
		say("`@Stop hitting my bench!", &var);
	}
	if(&junk == 2)
	{
		say("`@Go away!", &var);
	}
	if(&junk == 3)
	{
		say("`@Are you nuts?", &var);
	}
	if(&junk == 4)
	{
		say("`@This sword will get in your chest!", &var);
	}
	if(&junk == 5)
	{
		say("`@Is your skull empty?", &var);
	}
}
April 3rd 2010, 04:44 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Ok i fixed the problem, only for another problem to appear...

int &var;
&var = create_sprite(160, 110, 1, 380, 1);


IT DOESNT CREATE THE SPRITE...
Text appears but on the wrong positions
April 3rd 2010, 05:49 AM
slimeg.gif
metatarasal
Bard Male Netherlands
I object 
You're trying to create sequence 380, which doesn't exist. Unless you've added it yourself of course. Try using a sequence that exists, that is one you can find in (Win)DinkEdit.

Also, why are you giving it brain 1? Brain 1 is Dink, normally...
April 3rd 2010, 06:32 AM
goblinh.gif
mkbul
Peasant Male Greece
TPA~ 
Ok, thank you! Thought it works like base walk