[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Back up target variable
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Back up target variable

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by This_Guy   (13 posts)  [Biography] bio
Date Thu 30 Dec 2010 04:02 AM (UTC)
Message
I'm trying to build a variable that would feed my target variable a new target if the world sends me one of the following messages:

You do not see that individual here.

I do not recognize anything called that here.

You detect nothing here by that name.


How exactly would I go about this?
[Go to top] top

Posted by Nick Gammon   Australia  (21,647 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 30 Dec 2010 06:16 AM (UTC)
Message
What do you mean by "feed my target variable a new target"? What would the new target be?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by This_Guy   (13 posts)  [Biography] bio
Date Reply #2 on Thu 30 Dec 2010 06:27 AM (UTC)
Message
Say I kill a guy by the name of Dias, and i don't notice and someone name Ivellios is wailing on me. I want to be able to have someway to have Ivellios automatically targeted in case there is too much text coming at me to make anything out.
[Go to top] top

Posted by Manacle   (28 posts)  [Biography] bio
Date Reply #3 on Thu 30 Dec 2010 03:35 PM (UTC)
Message
I think I'd find your particular goal a difficult one to meet. You might find it easier to conceptualize if you instead target the core of the problem.

I wouldn't think of this as a problem of switching variables, but one of tracking your combat opponents. Can you identify specific messages that would begin (or simply indicate continuing combat with) opponents and also their deaths/fleeing?

If those messages are fairly well defined, it'd be a reasonable task to create a plugin that would automatically cycle through your current combatants as you kill them one by one. You'll use a series of triggers that view combatants entering (or continuing) combat with you and send them to a function that adds each of them to an array. You'll have a series of triggers that capture your kills and removes those opponents from the array. When your current target is removed from the array, you'll choose your target again as the first element of that array. (A more crude but more direct method of selecting a new target is to have a third set of triggers on the messages you mentioned in your last post so that you only switch targets when you attempt to swing at something that doesn't exist. Actually, you could do away with the death triggers if you don't mind those messages after each and every kill).

It may be slightly more difficult to handle multiple combatants of the same name or description.
[Go to top] top

Posted by This_Guy   (13 posts)  [Biography] bio
Date Reply #4 on Thu 30 Dec 2010 06:40 PM (UTC)
Message
I have an echo set for opponent deaths, but if one flees or if there is a mob of them and i can't see which one is hitting me things tend to get nasty pretty quick
[Go to top] top

Posted by Nick Gammon   Australia  (21,647 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Thu 30 Dec 2010 08:54 PM (UTC)
Message
You could easily make a trigger that matches:


You do not see that individual here.


That could set the target variable to an empty string. That doesn't however tell you who the new target is.

Without knowing your triggers it is hard to be more specific, but assuming you have some sort of trigger that detects if you are being attacked, and sets the target variable to whoever is attacking you, then that should cut in shouldn't it?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


3,968 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]