-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[script][afk]attempt to resolve justice messaging by releasing any triggers_justice spells active #6860
[script][afk]attempt to resolve justice messaging by releasing any triggers_justice spells active #6860
Conversation
desertkaz
commented
Jul 10, 2024
•
edited
Loading
edited
afk.lic
Outdated
@@ -51,6 +51,9 @@ loop do | |||
justice_message_count += 1 if line =~ /^"Burn .+! Burn .+!" .* giving you a wide berth/ | |||
justice_message_count += 1 if line =~ /authorities will try to bring you in for endangering the public/ | |||
|
|||
if justice_message_count >= 1 | |||
justice_message_count = 0 if DRSpells.active_spells.each { |x, _y| fput("release #{get_data("spells")["spell_data"][x]["abbrev"]} spell") if get_data("spells")["spell_data"][x]["triggers_justice"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
justice_message_count = 0 if DRSpells.active_spells.each { |x, _y| fput("release #{get_data("spells")["spell_data"][x]["abbrev"]} spell") if get_data("spells")["spell_data"][x]["triggers_justice"] } | |
fput("release #{get_data("spells")["spell_data"][x]["abbrev"]} spell") if get_data("spells")["spell_data"][x]["triggers_justice"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not ideal. What we want to do here is check if any of our active spells trigger justice. If any of them trigger justice, then release all the spells that trigger justice. We don't reset the counter here, because we rely on the counter for the def above, which exits the game if we reach justice threshold.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without resetting the counter for this "false positive", we would end up checking spells every loop from that moment until script closure. The goal was just to reset things if a spell was actually released to prevent that.
edit: Although, in hindsight, we would be doing that even for a non-justice spell related message once we hit > 0. We could leave the counter alone and just track some flag to only check once per justice_message_count increment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so my concern is that we need justice_message_count
to stay set so it gets checked properly against justice_threshold
I suppose yeah, what we need here is an additional flag then. So we only end up back into this new def if there was a change. So we see justice message count go over 1. We entered this def, we released all the offending spells. We set a flag we've done this for this justice_message_count value. We should then only re-enter this def if the justice_message_count changes, otherwise we'd be looping into it over and over.
The reason I'm not comfortable fully resetting justice_message_count is that there are other reasons/ways people might be getting tagged for justice, and if we reset the count, those might get missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I'm totally ok with that. and solved my initial reason for it in latest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, we should spell_check_count = justice_message_count
instead of incrementing a counter. they shouldn't get out of sync, but why risk it?
Thanks for this! |