Eliminates the 40 triggers involved in guessing which mob player last killed. That information only ever comes into play when a cp or gq mob is killed (function get_last_kill_index, called by cp_mob_killed and gq_mob_killed). It's used to make the GUI grey out the correct line item when you kill a cp mob. Nothing else in S&D currently uses it, but it wouldn't matter if it did. Details:
When you fight a mob, the mobname is broadcast from the GMCP handler and is referenced via gmcp("char.status.enemy") . When the mob dies, the information is eventually cleared, but there's timing involved. When you kill your cp (gq) mob and see "That was one of your cp (gq) mobs!", the information isn't cleared yet. It stands to reason that when you see that message, gmcp("char.status.enemy") must be the cp (gq) mob you just killed. There's no need to track damage messages, or guess anything, so we can remove those 40 triggers along with the relevant code.
The "char.status.enemy" field is only cleared (set to "") after the MUD sends the "You receive experience" message. And I do mean after. If you trigger on "You receive exp" then gmcp("char.status.enemy") will be the mob you just killed.
In the end, the 40 triggers are replaced with a one local variable "en" set to gmcp("char.status.enemy") in function get_last_kill_index, and the variable name "last_mob_killed" is replaced with that. The result is identical user presentation, without 40 triggers worth of CPU every time the MUD sends you a line.
Other fixes:
I fixed the GUI button animations. They once again light up like they're supposed to.
I fixed a few missing spaces and punctuation where I think it would look better. I get that a lot of that comes is a matter of personal opinion so unless something really glaring slips through I'm not going to waste your time harping on things like this.
Eliminates the 40 triggers involved in guessing which mob player last killed. That information only ever comes into play when a cp or gq mob is killed (function get_last_kill_index, called by cp_mob_killed and gq_mob_killed). It's used to make the GUI grey out the correct line item when you kill a cp mob. Nothing else in S&D currently uses it, but it wouldn't matter if it did. Details:
When you fight a mob, the mobname is broadcast from the GMCP handler and is referenced via gmcp("char.status.enemy") . When the mob dies, the information is eventually cleared, but there's timing involved. When you kill your cp (gq) mob and see "That was one of your cp (gq) mobs!", the information isn't cleared yet. It stands to reason that when you see that message, gmcp("char.status.enemy") must be the cp (gq) mob you just killed. There's no need to track damage messages, or guess anything, so we can remove those 40 triggers along with the relevant code.
The "char.status.enemy" field is only cleared (set to "") after the MUD sends the "You receive experience" message. And I do mean after. If you trigger on "You receive exp" then gmcp("char.status.enemy") will be the mob you just killed.
In the end, the 40 triggers are replaced with a one local variable "en" set to gmcp("char.status.enemy") in function get_last_kill_index, and the variable name "last_mob_killed" is replaced with that. The result is identical user presentation, without 40 triggers worth of CPU every time the MUD sends you a line.
Other fixes:
I fixed the GUI button animations. They once again light up like they're supposed to.
I fixed a few missing spaces and punctuation where I think it would look better. I get that a lot of that comes is a matter of personal opinion so unless something really glaring slips through I'm not going to waste your time harping on things like this.