Right now I have an NPC doing something in the background with a blank view above him providing random text sound effects. (rattle, tap tap, etc.) This I put as SayBackground in the Repeat_Execute in the interaction editor.
When I talk to the NPC, I want the text sounds to stop and then resume when the conversation ends and the NPC goes back to what he's doing. How would I temporarily stop what's in the Repeatedly_Execute?
Hope this makes sense.
Well, you could use a variable after all. Just call it "int skip_rep_ex" and set it to 1 if you want to skip the rep_ex function and to 0 if you want to run it. Then add this to your actual rep_ex function:
if ( skip_rep_ex == 0 )
// only if we don't want to skip the rep_ex function
{
// do your stuff now...
}
That's atleast one way that would work.
Okay, here's what I'm trying:
if ( skip_rep_ex == 0 ) {
if (pause > 0 ) {
pause--;
}
else if (speakline==Random(3)) {
Ã, character[BLA].SayBackground("Sentence 1!");
Ã, pause = 3*GetGameSpeed();
Ã, speakline=2;
Ã, }
else if (speakline==Random(3)) {
Ã, character[BLA].SayBackground("Sentence 2!!");
Ã, pause = 3*GetGameSpeed();
Ã, speakline=3;
}
else if (speakline==Random(3)) {
Ã, character[BLA].SayBackground("Sentence 3!!!");
Ã, pause = 3*GetGameSpeed();
Ã, speakline=1;
}
}Ã,Â
}
if ( skip_rep_ex == 1 ) {
Ã, character[BLA].Say(" ");
}
But I get an error that there's an unexpected "if" at the bottom of the code.Ã, Shouldn't this work?
You have 1 closing bracket too much (or many?). Get rid of one of those three that are written after each other, that should help if I'm not completly blind.
If I remove one I get a "missing '}' "
I would've posted the same thing before, but dkh beat me to it...
Can you post the whole repeatedly_execute script? It looks like the problem is just matching them up properly.
I already posted the entire code above....
I haven't changed anything.
Then you'll need to add one more to the bottom (inbetween the closing bracket for the rep_ex function and the last one that you posted here).
But that will only work if the rep_ex really ONLY consists of what you posted here! So, I take it that it says "function rep_ex ( ) {" right ABOVE what you just posted and that there is one closing "}" right AFTER what you posted, right?
If it still doesn't work, then please post the code WITH the "function rep_ex ( )" line and all that comes until the next function opens!
Okay.Ã, This is from the Global Script:
#sectionstart room_aÃ, // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
Ã, // script for Room: Repeatedly execute
if ( skip_rep_ex == 0 ) {
if (pause > 0 )
pause--;
}
else if (speakline==Random(3)) {
Ã, character[BLA].SayBackground("Sentence 1!");
Ã, pause = 3*GetGameSpeed();
Ã, speakline=2;
Ã, }
else if (speakline==Random(3)) {
Ã, character[BLA].SayBackground("Sentence 2!!");
Ã, pause = 3*GetGameSpeed();
Ã, speakline=3;
}
else if (speakline==Random(3)) {
Ã, character[BLA].SayBackground("Sentence 3!!!");
Ã, pause = 3*GetGameSpeed();
Ã, speakline=1;
}
}Ã,Â
}
if ( skip_rep_ex == 1 ) {
Ã, character[BLA].Say("");
}
Hope this is what you meant.
Take away one of the three as dkh said, and add one at the very end (after the if ( skip_rep_ex == 1) condition).
Sorry, but I still get the "unexpected if" message and it points to the "if ( skip_rep_ex == 1 )." I'm not sure what else it could be.
OK, I see it now - you're also missing an opening brace on the line if (pause > 0 ).
That should be it now, assuming the next line is the #sectionend bit. If it hasn't worked, use Ctrl-B to match all the braces and see where else the problem might be - it almost certainly IS a brace problem. (Another thing to try would be making if ( skip_rep_ex == 1 ) an else if.)
I can't believe I missed that. Thank you.