View Full Version : Help with finishing a script
I wrote a couple of scripts that work beautifully all the way up to the point when it is supposed to end (exit).
Here is an example:
#script
start:
.
.
.
match finish [You have completed your training task.]
.
.
.
finish:
echo
echo ================================
echo Script Complete! Type .gldillusion <<illusion>>, where
echo <<illusion>> is the illusion you need to perform publicly
echo for more training.
echo ================================
echo
exit
What happens is the script executes normally until the "[You have completed your training task.]" line shows up on the screen, but it appears that the script is not matching the "finish:" statement, and so the script continues to perfom illusions. I have actually gone so far as to copy and paste the "[You have completed your training task.]" verbiage into the script just to be sure that I didn't mistype anything.
Every one of the scripts I have written is behaving the exact same way. I use Stormfront.
Help? Thanks.
Here's the whole script if it will help. Could use some help with it. It is probably poorly written, as this is my first script, so if you find ways to make it more elegant, that would be appreciated too.
Thanks in advance.
#guildaud
echo
echo ==================================================
echo This script will perform audience repitions for
echo the Sorcerer Guild.
echo ==================================================
echo
start:
put illusion %1
match rose a perfectly-shaped black essence rose lies across your hand.
match pause ...wait
match full You need a free hand
match fail1 but suddenly the mana seeps away.
match fail2 until you lose the illusion.
match finish [You have completed your training task.]
matchwait
rose:
put stow %1
pause 32
goto start
pause:
goto start
full:
put drop %1
goto start
fail1:
goto start
fail2:
goto start
finish:
echo ================================================== ==
echo Script complete! Restart with .guildaud <illusion>,
echo where <illusion> is the illusion you need to perform
echo publicly.
echo ================================================== ==
exit
Nieninque
03-05-2008, 07:44 PM
Move
match finish [You have completed your training task.]
to the top of the list so it sees that first if it ocurs, otherwise it picks up rose first and doesnt even bother checking the rest of the list.
Deathravin
03-06-2008, 11:20 AM
I usually put my put action after all my matches but before the matchwait.
StartP:
Pause 1
Start:
match StartP ...wait
Match Finish [You have completed your training task.]
Match Rose remaining]
match Full You need a free hand
match Fail roundtime
put illusion %1
matchwait
Mainly because that way it loads the matches into memory before it does the action. I've had scripts (especially with a LOT of matches) not get to the end of the matches before the system had sent back a responce for the action. This was more many years ago with much slower PCs but it became a habit and helps you think about matches in a different way.
I changed my script (see below) and am still having the same problem. I may not have read or understood your instructions fully, so please take a look again and see if I missed something. Again, I'm using Stormfront if it matters.
#guildaud
echo
echo ==============================
echo This script will perform audience repitions for
echo the Sorcerer Guild.
echo ==============================
echo
start:
match finish [You have completed your training task.]
match rose a perfectly-shaped black essence rose lies across your hand.
match pause ...wait
match full You need a free hand
match fail1 but suddenly the mana seeps away.
match fail2 until you lose the illusion.
put illusion %1
matchwait
rose:
put stow %1
pause 32
goto start
pause:
goto start
full:
put drop %1
goto start
fail1:
goto start
fail2:
goto start
finish:
echo ================================================== ==
echo Script complete! Restart with .guildaud <illusion>,
echo where <illusion> is the illusion you need to perform
echo publicly.
echo ================================================== ==
exit
After the "[You have completed your training task.] line appears IG, it's like the script is not associating it with the "match finish" line of the script, and instead goes to the "match rose" part of the script. Almost like the script sees the successful rose first (which appears first on the screen), and immediately truncates the rest of the messaging, which ignores the part of the screen that reads, [You have completed your training task.]. Does that make sense?
Here is what it looks like when I have completed my last rose illusion:
You hold out your hand, palm facing up, and concentrate on its central point. Slowly, particles begin to coalesce with a unified will in your hand. One by one, petals dark as twilight begin to blossom up, taking the shape of a rosebud. Specks of colorless pollen appear within the flower as the rest of the details are filled in. After a moment, a perfectly-shaped black essence rose lies across your hand.
[You have completed your training task.]
Notice that the line, "a perfectly-shaped black essence rose lies across your hand" appears first (in bold), then the "[You have completed your training task.]" appears next. It looks to me like the script sees the "a perfectly-shaped black essence rose lies across your hand" line and immediately goes to the "match rose" line of the script and basically ignores the "match finish" part of the script.
Any thoughts?
BigWorm
03-09-2008, 04:54 PM
The easiest way I see around this is to have a second match block to see how far you are in your reps. I'm using the messaging I have from my rogue guild work, so you may have to fix the match strings:
start:
match rep_check a perfectly-shaped black essence rose lies across your hand.
match pause ...wait
match full You need a free hand
match fail1 but suddenly the mana seeps away.
match fail2 until you lose the illusion.
put illusion %1
matchwait
rep_check:
# This might not be the correct messaging for a successful rep
match rose repetiton remaining.]
match rose repetitions remaining.]
match rose was successful. You have
match finish [You have completed your training task.]
matchwait
finish:
...
exit
rose:
....
The easiest way I see around this is to have a second match block to see how far you are in your reps. I'm using the messaging I have from my rogue guild work, so you may have to fix the match strings:
start:
match rep_check a perfectly-shaped black essence rose lies across your hand.
match pause ...wait
match full You need a free hand
match fail1 but suddenly the mana seeps away.
match fail2 until you lose the illusion.
put illusion %1
matchwait
rep_check:
# This might not be the correct messaging for a successful rep
match rose repetiton remaining.]
match rose repetitions remaining.]
match rose was successful. You have
match finish [You have completed your training task.]
matchwait
finish:
...
exit
rose:
....
Actually, you just solved the problem, but not with the rep_check block. Instead of putting "After a moment, a perfectly-shaped black essence rose lies across your hand" as the successful line, I'll use the "[You have XX reptitions remaining.] block as my success flag. I'll need two of them, like you have in your rep_check block:
match rose repetiton remaining.]
match rose repetitions remaining.]
This way, the script is forced to look at this line, instead of the other line.
Thanks BigWorm!
Nieninque
03-09-2008, 06:32 PM
Please spell repetition correctly in your script.
Will save the bump on this thread.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.