PDA

View Full Version : How do I Spell Active without the spam?



Maerit
07-28-2017, 12:54 PM
I want to perform a Spell Active command (to update my current active spells list) without displaying the screen scroll spam. Any mechanic to do this via a script? Someone had mentioned using some downstreamhook function, but that is not something I'm familiar with.

Tgo01
07-28-2017, 12:57 PM
The ;dreavening script on the repo makes use of downstreamhook. You can pretty much just copy and paste that code and just change what you want squelched.

Back
07-28-2017, 01:18 PM
Are you using Stormfront? It has a Spell Active window.

Maerit
07-28-2017, 01:22 PM
I use stormfront, but the problem is I have to spell active to refresh the spells for infomon, so my script has to do spell active - I'll check out the dreavening script, thanks!

Maerit
07-28-2017, 01:31 PM
Hmm, I think your script is too smart for me, so I can't identify which areas of the script I have to copy to squelch all the spell active lines.

Tgo01
07-28-2017, 01:40 PM
Hmm, I think your script is too smart for me, so I can't identify which areas of the script I have to copy to squelch all the spell active lines.

Well I never!!!!!!!!!!!!!!!!!!!!


silence = proc {
action = proc { |server_string|
if server_string =~ /Elemental Defense II .|Elemental Defense III ./
nil
else
server_string
end
}
DownstreamHook.add("#{script.name}_silence", action)
}

silence.call

Just do something like that so whenever, for example, "Elemental Defense II ." appears in the game it will be automatically squelched. You can make it less sensitive, like just whenever "Elemental Defense" pops up on the screen it will be squelched (so you don't need to do Elemental Defense, Elemental Defense II, and Elemental Defense III), but then you run into the risk of a game line you actually want to see being squelched.

Maerit
07-28-2017, 01:50 PM
Cool, so I just changed it to "if server_string =~ /........./". How do I remove the squelch after it's been turned on? I noticed that running the script now makes it always squelch those lines - even after the script ends.

Tgo01
07-28-2017, 01:53 PM
You can do:



before_dying {
DownstreamHook.remove("#{script.name}_silence")
}


To the script so when you kill the script it removes the squelching stuffs.

Tgo01
07-29-2017, 04:47 AM
Cool, so I just changed it to "if server_string =~ /........./". How do I remove the squelch after it's been turned on? I noticed that running the script now makes it always squelch those lines - even after the script ends.

Almost forgot, in Ruby regex a . means a wildcard so this setup would squelch any line with at least 9 characters.

You should escape the periods so Ruby will only match actual periods, like so:

if server_string =~ /\.\.\.\.\.\.\.\.\./