• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Problem - Small Code problem in 10.0.4 Bind_AddToIgnore

Joined
Mar 23, 2017
RedCents
1,560¢
Rich (BB code):
5079:    Sub Bind_AddToIgnore(MTIgnore)
5080:        | Take the targeted mob as a parameter for mob to ignore.
5081:        /if (!${Defined[${MTIgnore}]}) /declare MTIgnore string local ${Target.CleanName}
5082:        /if (!${MTIgnore.Length} && ${Target.ID} && ${Spawn[=${Target.CleanName}].ID} &&       ${Select[${Target.Type},NPC,Pet]}) /varset MTIgnore ${Target.CleanName}
5083:       /if (!${MTIgnore.Length} || ${MTIgnore.Find[null]} || ${Spawn[${MTIgnore}].ID}==${Me.ID} ) {
                   /echo No NPCs detected. Nothing added to list.
                  /return
               }
Line 5082 does nothing because MTIgnore.Lenght will never be 0. At most it would repeat the action from line 5081. MTIgnore can either be a user provided string, the name of a target or the 4 char string "NULL" from the empty target. I assume that there are no valid targets with an empty string as a name.
In line 5083 the first clause is superfluous for the same reason.

I suggest this, which allows only npcs
Rich (BB code):
    Sub Bind_AddToIgnore(MTIgnore)
        | Take the targeted mob as a parameter for mob to ignore.
        /if (!${Defined[${MTIgnore}]}) /declare MTIgnore string local ${Target.CleanName}
        /if (${MTIgnore.Equal[null]} || !${Spawn[${MTIgnore}].Type.Equal[NPC]}) {
            /echo No NPCs named ${MTIgnore} detected. Nothing added to the list.
            /return
        }
...

If you want to allow pets you have to exlude pc pets. And there is the question whether pets of an actual npc always have the same name. So it would possibly be safer to add the name of the owner. The actual ignore routine does check whether the pet owner is to be ignored, does it ?
 
Uh, oh. I made the classical mistake of only testing the new stuff, adding from target. Calling /addignore with a user string currently terminates KA because
/if (!${Defined[${MTIgnore}]}) should be
/if (!${Defined[MTIgnore]})
Sorry.
After the initial test we know that we have the name of a npc. So the further simplified version is
Rich (BB code):
    Sub Bind_AddToIgnore(MTIgnore)
        | Take the targeted mob as a parameter for mob to ignore.
        /if (!${Defined[MTIgnore]}) /declare MTIgnore string local ${Target.CleanName}
        /if (${MTIgnore.Equal[null]} || !${Spawn[${MTIgnore}].Type.Equal[NPC]}) {
            /echo No NPCs named ${MTIgnore} detected. Nothing added to list.
            /return
        }
        | Assign temp var   list
        /declare IgnoreAdd string local ${MobsToIgnore}
        | If MobsToIgnore default text with the word null in it assign var spawn clean name
        /if (${IgnoreAdd.Find[null]}) {
            /varset IgnoreAdd ${Spawn[${MTIgnore}].CleanName}
        } else {
            /varset IgnoreAdd ${IgnoreAdd},${Spawn[${MTIgnore}].CleanName}
        }
        /if (${MobsToIgnore.Find[${Spawn[${MTIgnore}].CleanName}]}) {
            /echo >> ${Spawn[${MTIgnore}].CleanName} << already on Ignore List.
            /return
        }
        /ini "${InfoFileName}" "${ZoneName}" "MobsToIgnore" "${IgnoreAdd}"
        /echo AddToIgnore -> ${Spawn[${MTIgnore}].CleanName} <- Adding to Ignore list.
        | Reassign MobsToIgnore var the new list
        /varset MobsToIgnore ${IgnoreAdd}
    /return
This time tested in Feerot the dream with:
a) user input Kavri resulting in adding Kavri Flightfoot
b) user input garbage -> nothing
c) no input, no target -> nothing
d) target self -> nothing
e) target my pet -> nothing
f) target Zari Ikura -> add Zari Ikura
 
Problem - Small Code problem in 10.0.4 Bind_AddToIgnore

Users who are viewing this thread

Back
Top
Cart