📧 Message Board Archive

scripting help (again.....)
I'm a little new at this and my scripts rarely work as planned. In the samples i've looked at, some lines are tabbed right. Is that what i've missed? why?.thanks..................Ric
Re: scripting help (again.....)
: I'm a little new at this and my scripts rarely work as planned. In the samples i've looked at, some lines are tabbed right. Is that what i've missed? why?.thanks..................Ric



Well, a tabbed script is not the true solution. It makes writing and reading scripts easier. Just take a look at this:



void talk(void)

{

say_stop("Hello, this is a text", 1);

wait(300);

if (&story == 1)

{

say_stop("I only say this when story is one", 1);

}

if (&story == 2)

{

say_stop("But I say this when story is two", 1);

}

}



It's just an example and here's the same script but then with spaces:



void talk(void)

{

say_stop("Hello, this is a text", 1);

wait(300);

if (&story == 1)

 {

 say_stop("I only say this when story is one", 1);

 }

if (&story == 2)

 {

 say_stop("But I say this when story is two", 1);

 }

}



It makes reading the script easier and when scripts become bigger and/or difficulter, they are easier to read. Also note that you should use { and } at the correct places.



Simeon
Re: scripting help (again.....)
This board doesn't really show two spaces, so here it is with more space:



void talk(void)

{

say_stop("Hello, this is a text", 1);

wait(300);

if (&story == 1)

    {

    say_stop("I only say this when story is one", 1);

    }

if (&story == 2)

    {

    say_stop("But I say this when story is two", 1);

    }

}



Simeon



Re: scripting help (again.....)
: This board doesn't really show two spaces, so here it is with more space:



: void talk(void)



: {



: say_stop("Hello, this is a text", 1);



: wait(300);



: if (&story == 1)



:   {



:   say_stop("I only say this when story is one", 1);



:   }



: if (&story == 2)



:   {



:   say_stop("But I say this when story is two", 1);



:   }



: }



: Simeon



  Thanks, that will help some. but also the tutorials I have don't get too detailed about the use of { and } . The script I'm having trouble with starts with a random intro then dialogue choices . Do I use these nested {{ }} or sepprate? Thanks..................Ric  
Re: scripting help (again.....)
:   Thanks, that will help some. but also the tutorials I have don't get too detailed about the use of { and } . The script I'm having trouble with starts with a random intro then dialogue choices . Do I use these nested {{ }} or sepprate? Thanks..................Ric



It depends really.  Sometimes you can do it either way.  I personally prefer to not make if statements that use random integers seperate.  But like I said, it all depends on what you're trying to do.  Sorry I can't be of more help, but I don't know exactly what you're trying to accomplish and trying to explain everything about if's and whatnot would take way too long.
Re: scripting help (again.....)
: : Thanks, that will help some. but also the tutorials I have don't get too detailed about the use of { and } . The script I'm having trouble with starts with a random intro then dialogue choices . Do I use these nested {{ }} or sepprate? Thanks..................Ric



: It depends really. Sometimes you can do it either way. I personally prefer to not make if statements that use random integers seperate. But like I said, it all depends on what you're trying to do. Sorry I can't be of more help, but I don't know exactly what you're trying to accomplish and trying to explain everything about if's and whatnot would take way too long.



O.k. is there someone I could e-mail this script to for proofing? thanx...............Ric
Re: scripting help (again.....)
You could mail me or post it here(I think...)



If you've you &result twice... it can cause problems.

Re: scripting help (again.....)
: You could mail me or post it here(I think...)



: If you've you &result twice... it can cause problems.



Thanks I'll e-mail it 'cause I'm not sure how to post the whole thing here. If it helps the rand. intro goes ok, then choices pop-up ok. but then script skips to end ( and unfreezes ) thanks again........................Ric
*drums fingers impatiently* ----------------> <sup>[NT]</sup>
[No message content]
Re: *drums fingers impatiently* ---------------->
I sent It, maybe I try again......
Re: *drums fingers impatiently* ---------------->
: I sent It, maybe I try again......



or I'll try longhand.

void main (void)

void talk (void)

{

freeze (&current_sprite);

Freeze (1);

int &chat

&chat= random (3,1);

if (&chat == 1)

say_stop("'4hello, may I help you?",&current_sprite);

if (&chat == 2)

say_stop("'4Hi, do you need our services?",&current_sprite);

if (&chat == 3)

say-stop("'4What can we do for you?",&current_sprite);

wait (250);

}

{

choice_start()

"ask whats for sale"

"ask about the bringer of light"

"leave"

choice_end()

if (&result=1)

{

say_stop("what do you sell here?",1);

wait(250);

say_stop("'4A little of this and that.",&current_sprite);

}

if (&result=2)

{

say_stop("what can you tell me about the Bringer of light?",1);

wait (250);

say_stop("'4Nothing! leave us now...",&current_sprite);

}

if (&result=3)

{

say_stop("nothing for now thanks.",1);

}

unfreeze (&current_sprite);

unfreeze (1);

}

//when run the rand. intro is ok, choices run ok, but then script skips to end ( and unfreezes)







Re: *drums fingers impatiently* ---------------->
WOW. Try this:



: if (&result == 1)



: {



: say_stop("what do you sell here?",1);



: wait(250);



: say_stop("'4A little of this and that.",&current_sprite);



: }



: if (&result == 2)



: {



: say_stop("what can you tell me about the Bringer of light?",1);



: wait (250);



: say_stop("'4Nothing! leave us now...",&current_sprite);



: }



: if (&result == 3)



: {



: say_stop("nothing for now thanks.",1);



: }



: unfreeze (&current_sprite);



: unfreeze (1);



: }



: //when run the rand. intro is ok, choices run ok, but then script skips to end ( and unfreezes)



:  



The rest ain't great either, but that's probably because the forum does something with the coded or something.



You need "==" with a space in any "test equality" statement
Re: *drums fingers impatiently* ---------------->
: WOW. Try this:



: : if (&result == 1)



: : {



: : say_stop("what do you sell here?",1);



: : wait(250);



: : say_stop("'4A little of this and that.",&current_sprite);



: : }



: : if (&result == 2)



: : {



: : say_stop("what can you tell me about the Bringer of light?",1);



: : wait (250);



: : say_stop("'4Nothing! leave us now...",&current_sprite);



: : }



: : if (&result == 3)



: : {



: : say_stop("nothing for now thanks.",1);



: : }



: : unfreeze (&current_sprite);



: : unfreeze (1);



: : }



: : //when run the rand. intro is ok, choices run ok, but then script skips to end ( and unfreezes)



: :



: The rest ain't great either, but that's probably because the forum does something with the coded or something.



: You need "==" with a space in any "test equality" statement



Thanks ..................Ric