I've been trying to figure this out for a while, but I fear I'm not seeing the entire solution quickly, and now I'm needing a fresh set of eyes to accomplish what I need.
I have a very particular script for the MUD I play to help me differentiate between MOBs and players when in a room. The script itself works, but now I want to add a new element that will check if my group mates are in the same room. This is what I have so far:
function strends(s)
if s:match("%u%w+ is here%.") or s:match("%u%w+ is fighting .-%.") or s:match("%u%w+ is sleeping here%.") then
return true
else
return false
end
end
That's working great - it checks if an upper case name is in the room and returns information as requested.
I have a table of my group mates, though I may find it easier to do it as a string and do string.find. The problem I'm running into is casing it for each of the scenarios:
- Return true if there are players outside my group in the room.
- Return false if it's only players outside my group.
- Return false if there is no one in the room aside from myself.
In scenario one, it MUST return true, even if there are people in my group as well as people outside my group. But my Lua knowledge isn't expansive enough that I can work out the problem. The reason for the non-beginning string.matches is because it's possible for the particular line to have xx amount of characters before it. How should I approach this, or what should I be doing in order to accomplish my goal?
Aucun commentaire:
Enregistrer un commentaire