The Dink Network

Script Problem and some questions.

November 9th 2010, 01:21 AM
duckdie.gif
In my Milder D-Mod, I have a scene where Quackers gives Milder some magic for some money. But the script won't work. I think there's some problem with the local variable. I made a local variable called &gimme. But Milder doesn't get the magic, nor does Quackers do anyting after the void main script.


void main( void)
{

int &gimme;
&gimme = 0;

if(&story == 1)
{
freeze(1);
freeze(&current_sprite);
say_stop("Hey, Quackers!", 1);
wait(2500);
move_stop( &current_sprite, 4, 166, 1);
say_stop("`3 What is the meaning of this?", &current_sprite);
say_stop(" Terribly sorry to disturb you sir, but I need help.", 1);
say_stop(" I need some magic to slay a Bonca", 1);
say_stop("`3 Use you fists. You have such fat hands", &current_sprite);
wait(2000);
say_stop("`3 I will give it to you, in return for 20 gold pieces.", &current_sprite);
&gold -= 20;
say("Hey! You didn't give me any magic!", 1);
&gimme = 1;
unfreeze(1);
unfreeze(&current_sprite);
}
}

void talk( void);
{
if( &gimme == 1)
{
say_stop("`3 All right. Here you go", &current_sprite);
add_magic("item-fb", 437, 1);
&gimme = 2
}
if(&gimme == 2)
{ 
say("`3 Get lost!", &current_sprite);
}
}

]
November 9th 2010, 04:27 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Please note that as a rule of the thumb local variable does not survive screen changes. So you will continue to get the magic every time you leave the screen and ask for it again. Also note that in the void talk(void) both the &gimme == 1 and &gimme == 2 will be executed. Perhaps this is intentional, but I thought I'd just remind you.

As for your problem, replace this:
void talk(void);

with this:
void talk(void)


Procedures such as void talk, void main or void hit should not have a semicolon!
November 9th 2010, 04:36 AM
dinkdead.gif
It might be the space, too.
if( &gimme == 1)

should be
if(&gimme == 1)


And if it is intentional, that last thing metatarasal metioned, then there's no need for the &gimme == 2 at all, you could just do this if you like:

void talk(void)
{
  if(&gimme == 1)
  {
    say_stop("`3 All right. Here you go", &current_sprite);
    add_magic("item-fb", 437, 1);
    &gimme = 2;
    //don't forget semicolon here!
  }
  say("`3 Get lost!", &current_sprite);
}
November 9th 2010, 05:39 AM
duckdie.gif
Thanks you both! I'll try it. By the way, how do you copy the map from another D-Mod? (ALL screens) I found a file called FreeMap and decided to use it instead of creating everything. I copy the map.dat file into my D-Mod directory but only one screen shows up.

Oh, and I'll make the &gimme a global variable instead of a story variable! That way it WILL survive screen changes
November 9th 2010, 05:03 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
FreemMap? Sounds... Lazier than any other Dmodder...

You honestly can't expect to use someone elses map and get away with small modifications when they'll have their own sprites, hardness, and even scripts set up for things. You'll have enemy sprites that just sit there if you attempt it, I reckon.

And if it is only one screen that shows up, then that's the only screen on this so-called free map.

EDIT: After reading through a second thread this post has become redundant.
November 10th 2010, 05:47 AM
duckdie.gif
No. It has no sprites, it is basically just the map with no interactive stuff. And if you play the FreeMap itself it has 350+screens.