Skip to content
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

Merged
merged 12 commits into from
Jul 21, 2024

Conversation

desertkaz
Copy link
Contributor

@desertkaz desertkaz commented Jul 10, 2024

image

@desertkaz desertkaz changed the title [script][afk]attempt to resolve justice messaging by release cyclic when active [script][afk]attempt to resolve justice messaging by releasing any triggers_justice spells active Jul 11, 2024
afk.lic Outdated Show resolved Hide resolved
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"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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"] }

Copy link
Collaborator

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.

Copy link
Contributor Author

@desertkaz desertkaz Jul 18, 2024

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?

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

@desertkaz desertkaz Jul 18, 2024

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?

@MahtraDR MahtraDR merged commit 0746384 into elanthia-online:master Jul 21, 2024
2 checks passed
@MahtraDR
Copy link
Collaborator

Thanks for this!

@desertkaz desertkaz deleted the desertkaz-patch-1 branch July 21, 2024 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants