View Full Version : Something Stupid
vamosj
09-02-2011, 10:23 PM
For some reason this thing isn't working.. I know it's probably something stupid but I can't for the life of me figure out why...
All this is for is I have it set to a macro.. It runs me to the west gate of landing and if the guard isn't there I just hit it again and away we go to helga's. Damn thing just keeps running T: even when at the gate. I've tried swapping the match lines in case its process dependent but it still runs me to room 420....
Let the stupid comments fly but at least provide what stupid part I'm not seeing......
put look
match T e
match A The muted sounds of loud bartering
matchwait
T:
put ;go2 420
exit
A:
put ;go2 3809
exit
Bobmuhthol
09-02-2011, 10:41 PM
Wouldn't "e" always show up, and thus, it would always go to T? I don't know exactly how MATCH works (whether it checks "Is this line here?" or "Which match happens first?") but if it's the latter then "e" is seen before an entire phrase every time. Use unique match strings.
boardergeek
09-02-2011, 11:24 PM
Welp, I don't understand is that your using lich. So why not write the equivalent of
if Room.current.id != 420
start_script("go2" ,["420"])
else
start_script("go2" ,["3809"])
end
vamosj
09-03-2011, 01:21 AM
Haven't learned Ruby Yet... I should start.
Was using lich scripts that were already in place.
vamosj
09-03-2011, 01:23 AM
Wouldn't "e" always show up, and thus, it would always go to T? I don't know exactly how MATCH works (whether it checks "Is this line here?" or "Which match happens first?") but if it's the latter then "e" is seen before an entire phrase every time. Use unique match strings.
How would I set up the match string for every other room other than the west gate is what I couldn't come up with... hence the e cause it must have some sort of search string.
If I'm not at the west gate the script should take me to room 420 (can happen anywhere).
If I am at west gate (420) then it sends me to helga's.
Bobmuhthol
09-03-2011, 01:33 AM
It's been a while but I think you can match against "Obvious exits" because it necessarily appears after the first line of the West Gate description. This should only fail if a room doesn't have an "Obvious exits" line, which I'm not sure is ever the case; if it is, then you might try matching against "." since the description phrase should still be matched first.
if Room.current.id != 420
start_script("go2", [420])
else
start_script("go2", [3809])
end
edit: i am drunk in case that had typos
boardergeek
09-03-2011, 03:36 AM
Isn't that what I write above?
vamosj
09-03-2011, 12:19 PM
Don't worry boardergeek, I used yours and made the lich script.... I would still like to know for future reference if anyone has an idea bout the stormfront script and why it's not working..
Don't worry boardergeek, I used yours and made the lich script.... I would still like to know for future reference if anyone has an idea bout the stormfront script and why it's not working..
I thought Bob's explanation was pretty sound. Did you check to see if there is an 'e' somewhere before the other match string when you do a look at the west gate?
Bobmuhthol
09-03-2011, 01:57 PM
Did you check to see if there is an 'e' somewhere before the other match string when you do a look at the west gate?
I have a feeling subsets will match before the larger set. That is, if you're matching "There are a lot of dicks in here" and "lot," then "lot" will always match first. In this case, he's matching "e" when "e" certainly appears within the other match, which would explain why it always goes to the same place. That's why I think if you use "." it will work; "." must show up after the first match has processed, as long as the first match is the first sentence.
DaCapn
09-03-2011, 03:48 PM
For a wizard script, can't you just flip the order of the match statements? Just put the general one second so the specific one matches first.
EDIT: As a follow-up, isn't this the perfect time to totally ditch wizard scripts and just switch to using lich?
Gibreficul
09-14-2011, 09:13 AM
Don't worry boardergeek, I used yours and made the lich script.... I would still like to know for future reference if anyone has an idea bout the stormfront script and why it's not working..
match strings are prioritized in the order they're listed... You're matching for the letter "e" and then the next line, you're matching for something that includes the letter e. The second match will NEVER fire. NEVER. SF does honor some regular expression syntax, but at that point, you may as well just write it in Lich and have full regexp capabilities.
vamosj
09-14-2011, 09:59 AM
Thanks for the input there Mr. Gib.. I've started looking at the lich scripting and so far the pieces are not falling together for me. Programming is always a puzzle for me that once I find the right piece, then everything starts to fall into place. I tried to do something small such as altering the ;keepalive to retrigger my current SF script but so far it's not working.
#!/usr/bin/env ruby
# All this does is wait for the 'YOU HAVE BEEN IDLE TOO LONG' message (waitfor is case insensitive), send a 'look' to the game, and echo a timestamp.
setpriority(-2)
n = 0
while true
waitfor "you have been idle too long"
fput "drop hammer"
fput "drop bar"
fput "out"
fput "/hammertime"
n += 1
echo "TIMESTAMP ##{n}: #{Time.now}"
waitfor "****************NOD TO CONTINUE, HIT ESC TO EXIT*****************"
fput "nod"
end
I'll read more about the coding later.. I do vba programming in excel but you can at least step through that to see how things are working... This one I just need to dig a little more into the books...
Gibreficul
09-14-2011, 10:16 AM
the error in that script you posted is the waitfor line... that line will NEVER happen... and escape doesn't terminate lich scripts. I think you wanted echo or respond there.
Trick to Ruby, as with any programming language, is the syntax. Any text/string needs to be quoted... That was the big barrier I had to get over. After that, it was adding small pieces little by little, and eventually look back and realize I have the ability to do a lot of previously complex things without a lot of effort. If you haven't done so already, find a GOOD text editor, Notepad++ is popular, my personal preference is Textpad. Both have syntax highlighting for Ruby... those highlights are priceless when you're starting out.
It's been a while but I think you can match against "Obvious exits" because it necessarily appears after the first line of the West Gate description. This should only fail if a room doesn't have an "Obvious exits" line, which I'm not sure is ever the case; if it is, then you might try matching against "." since the description phrase should still be matched first.
Obvious exits for indoors rooms, obvious paths for outdoors.
vamosj
09-15-2011, 03:07 AM
Too tired.. Getting my threads mixed up.. This was suppose to be for my forging hammers hangup... But thanks for the feedback...
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.