PDA

View Full Version : Watchfor



Imperarx
07-29-2008, 04:45 PM
So, I've been trying to write a script that would walk around and kill a few things to make my trips out of town and back quicker. As part of that, I wanted it to make intelligent decisions about my surge of strength and getting out of stuns, so I tried to register Watchfors to manipulate variables for this, but I'm getting errors. Can anyone tell me what's wrong with the following code?


Watchfor.new "You are stunned"
{
if checkmana > 35
waitrt?
fput "beseech"
end
}

Watchfor.new "searching for untapped sources of strength."
{
checksurge = true
surgecd = false
}

Watchfor.new "You begin to lose touch with your internal sources of strength."
{
checksurge = false
}

Watchfor.new "Your internal strength fully recovers from your most recent attempt to tap into it."
{
surgecd = true
}

Below are the errors I get.


hunt:14: odd number list for Hash
hunt:19: odd number list for Hash
hunt:20: syntax error, unexpected tIDENTIFIER, expecting '}'
surgecd = false
^
hunt:21: syntax error, unexpected '}', expecting $end

Any ideas?

Deathravin
07-31-2008, 10:10 AM
Surge of Strength is listed in the spell-list.txt as spell # 9605
I'd use that personally... and that's arund all your errors, looks like the beseech part works alright. All the errors are after line 14.
You could make another spell that works like this:

9606:Surge of StrengthCD
10:0:1
You focus deep within yourself, searching for untapped sources of strength\.(?:[\s\w\.]+)?
Your internal strength fully recovers from your most recent attempt to tap into it\.


At any rate, for your initial question, could it be the period? take out the ending peroids and see if it works. Maybe I'm just thinking about the spell-list.txt where you need a \. for a peroid.

BigWorm
07-31-2008, 10:44 AM
Surge of Strength is listed in the spell-list.txt as spell # 9605
I'd use that personally... and that's arund all your errors, looks like the beseech part works alright. All the errors are after line 14.
You could make another spell that works like this:

9606:Surge of StrengthCD
10:0:1
You focus deep within yourself, searching for untapped sources of strength\.(?:[\s\w\.]+)?
Your internal strength fully recovers from your most recent attempt to tap into it\.


At any rate, for your initial question, could it be the period? take out the ending peroids and see if it works. Maybe I'm just thinking about the spell-list.txt where you need a \. for a peroid.

I already added this to my spell-list.txt. I works pretty well but once in a while it will miss the start of the cooldown.

Renian
07-31-2008, 11:46 AM
Sorry to somewhat hijack, but can you use Regex with Watchfor? If so, I have an idea.

Shaelun
08-08-2008, 01:18 AM
The "watchfor" code is still in the project, but if memory serves I disabled them... quite frankly I can't even remember why. Some bug or problem that I put off until later; as it turned out, "later" never came.

You're getting warnings because of your syntax. In C, I much prefer code exactly like that... but Ruby is a line-oriented language, and that doesn't fly. Put your opening curly brace on the same line as the Watchfor.new -- but again, if memory serves, that feature doesn't do anything.