📧 Message Board Archive

More random script fun
As long as there are mods, makers will have questions! Thanks to all in advance if you could help sort out this dilema:



I figured out how to make Dink start with the "God Sword of Doom", and I even got him to say something whenever he equips it. :o Instead of just one thing, however, I'd like him to say a few random things every time he pulls it out. The code I tried hasn't worked:



void armmovie(void)

{

&pap = random(5, 1);

if (&pap == 1)

{

 say("Ah, I have armed my God Sword of Doom! Mwahaha!", 1);

}

if (&pap == 2)

{

 say("I love my God Sword of Doom!", 1);

}

if (&pap == 3)

{

 say("Its time to kick ass and chew bubblegum!", );

 wait(1000);

 say("And I'm all outta gum!", 1);

}

if (&pap == 4)

{

 say("Come get some!", 1);

}

if (&pap == 5)

{

 say("Hiya!", 1);

}

}



I also have a script at the top of the page:



void main( void )

{

int &pap;

}



could anyone help me with this? or is it impossible?



Also, if anyone could help me in making a pushable object, I would be much grateful!

I looked at the script for the pushable rock in the Dink directory, but it didn't help much...







Re: More random script fun
As far as pushable object, just put a



void push( void )

{

//find out which direction dink is facing

int &dinkdir = sp_dir(1, -1);

if (&dinkdir == 2)

   move_stop(&current_sprite, 2, y, 1);

etc for other directions



}



procedure in there, and also set a sp_speed(&current_sprite, 1) for the object.
Re: More random script fun
: As long as there are mods, makers will have questions! Thanks to all in advance if you could help sort out this dilema:

: I figured out how to make Dink start with the "God Sword of Doom", and I even got him to say something whenever he equips it. :o Instead of just one thing, however, I'd like him to say a few random things every time he pulls it out. The code I tried hasn't worked:

: void armmovie(void)

: {

:  &pap = random(5, 1);

:  if (&pap == 1)

:  {

:  say("Ah, I have armed my God Sword of Doom! Mwahaha!", 1);

:  }

:  if (&pap == 2)

:  {

:  say("I love my God Sword of Doom!", 1);

:  }

:  if (&pap == 3)

:  {

:  say("Its time to kick ass and chew bubblegum!", );

:  wait(1000);

:  say("And I'm all outta gum!", 1);

:  }

:  if (&pap == 4)

:  {

:  say("Come get some!", 1);

:  }

:  if (&pap == 5)

:  {

:  say("Hiya!", 1);

:  }

: }

: I also have a script at the top of the page:

: void main( void )

: {

:  int &pap;

: }



Here's your problem. Item scripts don't have a main() procedure. Put int &pap; in arm() instead. In fact, put the rest of that in arm too, nobody uses armmovie, despite what dinkc.txt says, and while it probably works fine, if it didn't no one would be able t help you.



One other thing, in most case, it's better to use say_stop instead of say if someone needs to say more than one thing in a row. That way you don't need to put in the wait(1000) and as an extra bonus, if Dink is frozen (which he isn't in this case I guess) the user can press space to let the computer know their done reading the first message if they don't want to wait.
Re: More random script fun
: One other thing, in most case, it's better to use say_stop instead of say if someone needs to say more than one thing in a row. That way you don't need to put in the wait(1000) and as an extra bonus, if Dink is frozen (which he isn't in this case I guess) the user can press space to let the computer know their done reading the first message if they don't want to wait.



Most of what Paul said is what you need to do, but I don't recommend to use say_stop in here. In fact, if Dink is NOT frozen, hitting space would interrupt say_stop function and Dink won't say the rest of the lines. But I don' like Dink to say more than one line after he equips an item especially if Dink wants to talk to some people right after he equips an item. One line of say("...", 1); should be good enough.