View Full Version : How do you properly loop an action until a matching string is seen?
So I'm not sure how to do do {} while (blah blah) loops in Ruby. I'm trying to make a script to use all my keys on a chest, until no more keys are found in my inventory:
So, something like:
until("Get what?")
fput "get my key"
fput "unlock chest with my key"
fput "drop my key"
end
The above is not valid code, since until("Get what?") is just made up syntax. So how can I express this in loop properly?
Maybe I'm not expressing myself well, I basically need to know two separate things:
1. How to do loops in Ruby that repeat until a certain condition is true
2. How to scan the output from the game for a specific string and then trigger a flag that would exit the loop above
Ososis
01-20-2018, 09:28 PM
I don’t ruby, just stormfront, so I expect this won’t help but would I would do is
KEY:
Match END get what?
Match GO you remove (or whatever your container verbiage is)
Put get my key
Matchwait
GO:
Put unlock chest with my key
Put drop key
Goto KEY
END:
Mogonis
01-20-2018, 09:47 PM
loop do
fput "get my key"
result = waitfor "You remove","Get what"
break if result =~ /Get what/
fput "unlock chest with my key"
fput "drop my key"
end
loop do
fput "get my key"
result = waitfor "You remove","Get what"
break if result =~ /Get what/
fput "unlock chest with my key"
fput "drop my key"
end
That worked perfectly, thanks.
Maerit
07-27-2018, 11:02 AM
Out of curiosity, what keys are opening what chests? Is this something I never learned about warcamps!?
crude keys open the one chest at the end, problem is I tend to accumulate dozens and dozens of them, so have to use them all before it clicks open sometimes
Maerit
07-27-2018, 01:23 PM
Gotcha. It would be kind of neat if the crude keys would work on the boxes inside the chest, but using one would cause it to break. That would give value to collecting more than one key per warcamp.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.