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

Gammon Software Solutions forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Variable Question - AutoTargetting
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Variable Question - AutoTargetting
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Larkin   (278 posts)  [Biography] bio
Date Fri 08 May 2009 11:33 AM (UTC)  quote  ]
Message
I would suggest that what you really want to do is capture all the keywords (names) from INFO HERE, putting them into a list as you go. When you hit the Number of objects line, you scan that list against your priority list of valid targets you want to hunt. That way, if you walk into a room with a cave-fisher and a solifugid, you could prioritize attacking the cave-fisher first, since he's already aggressive.
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Thu 07 May 2009 07:35 PM (UTC)  quote  ]
Message
That language looks like Lua. Replace != by ~=, since != isn't valid in this language.
[Go to top] top

Posted by Chade   (13 posts)  [Biography] bio
Date Thu 07 May 2009 06:20 PM (UTC)  quote  ]
Message
Thanks!

Encountering this problem now though:

Compile error
World: Treant
Immediate execution
[string "Trigger: ihbash_"]:1: 'then' expected near '!'
[Go to top] top

Posted by Tboydston   (14 posts)  [Biography] bio
Date Thu 07 May 2009 05:51 PM (UTC)  quote  ]
Message
This isn't too terribly hard, I promise.

Here's the issue: When you encounter a pony, you disable the trigger that follows your INFO HERE (the command that prompts the list of items in a room, for those that don't do IRE games). Now, if it didn't do this, you'd always target the last name on the list. For example:

"MUSHUser0001" Nick Gammon
"MUSHUser1853" Thomas B
"MUSHUser0892" Worstje


Your trigger basically scans for things in quotes that end with number. Since it doesn't see a pony, that trigger will execute three times and end by targeting MUSHUser0892, who is Worstje. If MUSHUsr1853, Thomas B, was actually a pony, that is
"MUSHUSer0001" Nick Gammon
"Pony0022" Thomas B
"MUSHUser0892" Worstje
things would happen like this:
MUSH sees "MUSHUSer0001", it's not a pony, so we
Execute("t %1;bashon")
EnableTrigger("ihbash_", false)
, then it sees a pony. So, it does this:
display.Info("NO TARGETS HERE")
EnableTrigger("ihbash_", false)
.
Now that the ibash_ trigger is turned off, it won't be able to see Worstje. Problem!

Here's how to fix the pony issue. Change the entire <send> schtuff to:
if "%1" != "pony" then
Execute("t %1;bashon")
EnableTrigger("ihbash_", false)
end

We want the pony to be ignored, this will do that.
Now, you're still going to have the issue of your target always being the last item in the room since that'll be the last line in the IH.

If you really want to stop targeting inanimate objects completely you'll need either a list of animate objects or a list of inanimate objects to target/avoid. The script has no idea if the item can be targeted or not unless you code in a few things to look out for.
[Go to top] top

Posted by Chade   (13 posts)  [Biography] bio
Date Thu 07 May 2009 03:12 PM (UTC)  quote  ]
Message
Hi,

Still quite new to coding in lua and MUSH itself, just wanted to see if I could get a bit of help with something. I'm trying to write a script which will automatically target things for me, but I want to write a few exceptions into the script. My current version looks a little like this:

<triggers>
<trigger
expand_variables="y"
group="Chade"
ignore_case="y"
keep_evaluating="y"
match="^\&quot;(.+?)\d+\&quot;"
name="ihbash_"
regexp="y"
send_to="12"
sequence="100"
>
<send>if "%1" == "pony" then
display.Info("NO TARGETS HERE")
EnableTrigger("ihbash_", false)
else
Execute("t %1;bashon")
EnableTrigger("ihbash_", false)
end
</send>
</trigger>
</triggers>

This works relatively well for my purposes but has a few problems and I want to make it work better.

This is a quick example of what the NPC/Item list looks like:

"gatekeeper42866" a hooded gatekeeper
"pony36065" a pale blue, sleek pony with feathered wings
Number of objects: 2

I own the pony which is why I don't want it targetted. In the above situation the script works fine, but if I enter the room and then an NPC follows me in I encounter problems, the pony becomes the first NPC on the list which prevents the auto-targetter working.

"pony36065" a pale blue, sleek pony with feathered wings
"gatekeeper42866" a hooded gatekeeper
Number of objects: 2

The final problem I have is when inanimate objects are on the list, as 9 times out of 10 they've always first on the list.

"seal47870" a circular seal
"gatekeeper42866" a hooded gatekeeper
"pony36065" a pale blue, sleek pony with feathered wings
Number of objects: 3

If I attempt to target and attack the seal, as it's an item I get one of three messages:

Ahh, I am truly sorry, but I do not see anyone by that name here.

You detect nothing here by that name.

Nothing can be seen here by that name.

Anyone have any suggestions as to what I could do to improve functionality?

Cheers,

Chade
[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.


2,371 views.

[New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]