The Dink Network

Help

December 4th 2005, 05:27 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
I am currently working on Victim Of Life to get it to work, but I have a problem with a script.

void main( void )
{
int &karl = create_sprite(290, 230, 16, 381, 1);
sp_speed(&karl, 2);
sp_base_walk(&karl, 380);
preload_seq(381);
preload_seq(383);
preload_seq(385);
preload_seq(387);
preload_seq(389);


void talk(void)
{
freeze(&karl);
freeze(1);
choice_start()
"have you seen a guy named David"
"who are you"
"nevermind"
choice_end()
unfreeze(1);
unfreeze(&karl);


if (&result == 1)
{
freeze(1);
freeze(&karl);
say_stop("have you seen a guy named David", 1);
say_stop("`0maybe. I saw a guy with blue clothes for some minuttes ago", &karl);
say_stop("Ok?", 1);
say_stop("`0I saw him with a famer ", &karl);
say_stop("where did he go", 1);
say_stop("`0I don`t know", &karl);
say_stop("Ok thanks", 1);
unfreeze(1);
unfreeze(&karl);
}


if (&result == 2)
{
freeze(1);
freeze(&karl);
say_stop("Hi what is your name?", 1);
say_stop("`0My name is Carl", &karl);
unfreeze(1);
unfreeze(&karl);
}
}
}

The sprite gets created, but it wont talk.

December 4th 2005, 06:36 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
Try a closing bracket } after preload_seq(389); to close void main(void) and remove the redundant one at the bottom (you only need two closing brackets there because you only need to close the second if-statement and the void talk(void) procedure.

So try:

void main( void )
{
int &karl = create_sprite(290, 230, 16, 381, 1);
sp_speed(&karl, 2);
sp_base_walk(&karl, 380);
preload_seq(381);
preload_seq(383);
preload_seq(385);
preload_seq(387);
preload_seq(389);
}

void talk(void)
{
freeze(&karl);
freeze(1);
choice_start()
"have you seen a guy named David"
"who are you"
"nevermind"
choice_end()
unfreeze(1);
unfreeze(&karl);

if (&result == 1)
{
freeze(1);
freeze(&karl);
say_stop("have you seen a guy named David", 1);
say_stop("`0maybe. I saw a guy with blue clothes for some minuttes ago", &karl);
say_stop("Ok?", 1);
say_stop("`0I saw him with a famer ", &karl);
say_stop("where did he go", 1);
say_stop("`0I don`t know", &karl);
say_stop("Ok thanks", 1);
unfreeze(1);
unfreeze(&karl);
}

if (&result == 2)
{
freeze(1);
freeze(&karl);
say_stop("Hi what is your name?", 1);
say_stop("`0My name is Carl", &karl);
unfreeze(1);
unfreeze(&karl);
}
}
December 4th 2005, 06:44 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
Nope its not that, I tried it before I submitted the post
December 4th 2005, 06:53 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
But that doesn't mean you should just place the brackets where you please

Also, you should place the freeze commands only in the beginning and only unfreeze at the end, and not after a choice menu and in every option. That way it's easier to keep track of what happens when the player might press space to skip a conversation.

And.. I'm still a bit sleepy I see That void talk(void) is the talk procedure of the sprite that the script's attached to. So if you go to the sprite you created, he won't talk because he doesn't have a script attached. If you want him to talk, you should attach a script to him and in that script, you should place talk, hit, etc
December 4th 2005, 07:00 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
Yes, the sprite we're created in another script and it had the talk procedure in another script, but that made it buggy for Dink v1.08, but I'll try once more.

EDIT

Script #1
void main( void )
{
int &karl = create_sprite(290, 230, 16, 381, 1);
sp_speed(&karl, 2);
sp_script(&karl, g2);
sp_base_walk(&karl, 380);
preload_seq(381);
preload_seq(383);
preload_seq(385);
preload_seq(387);
preload_seq(389);
}

Script #2
void talk(void)
{
freeze(&karl);
freeze(1);
choice_start()
"have you seen a guy named David"
"who are you"
"nevermind"
choice_end()
unfreeze(1);
unfreeze(&karl);


if (&result == 1)
{
freeze(1);
freeze(&karl);
say_stop("have you seen a guy named David", 1);
say_stop("`0maybe. I saw a guy with blue clothes for some minuttes ago", &karl);
say_stop("Ok?", 1);
say_stop("`0I saw him with a famer ", &karl);
say_stop("where did he go", 1);
say_stop("`0I don`t know", &karl);
say_stop("Ok thanks", 1);
unfreeze(1);
unfreeze(&karl);
}


if (&result == 2)
{
freeze(1);
freeze(&karl);
say_stop("Hi what is your name?", 1);
say_stop("`0My name is Carl", &karl);
unfreeze(1);
unfreeze(&karl);
}
}

this made it buggy and Carl would still not talk.
December 4th 2005, 07:24 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
try replacing:
sp_script(&karl, g2);
with:
sp_script(&karl,"g2");
December 4th 2005, 08:32 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
I'll try tonight when im not lazy
December 4th 2005, 09:10 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
In addition, you'd now need to refer to the sprite as &current_sprite in Script #2 as that's the sprite the script's attached to
December 4th 2005, 09:40 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
You mena løike &karl = &current_sprite; ?
December 4th 2005, 09:58 AM
duck.gif
Tal
Noble He/Him United States
Super Sexy Tal Pal 
Er, um... yes, sorta

I think I know what you want, but I'm not sure; I need to get off my butt and learn DinkC
December 4th 2005, 10:03 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
It was just the way I did before I started editing the script lol. Maybe I shouldn't use create sprite
December 4th 2005, 10:06 AM
duck.gif
Tal
Noble He/Him United States
Super Sexy Tal Pal 
Yeah... if you place the sprite on the map in Dinkedit, just attach a script to it and don't worry about any create sprite crap. And again, if you're going to do that, you'd use &current_sprite instead of &karl.
December 4th 2005, 10:07 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
I know, but this was the first D-Mod I created when I learned using create_sprite and the Global Variables.