[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]  General
. . -> [Subject]  How can I make something to recognize certain items?
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

How can I make something to recognize certain items?

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

Posted by Rjak   Romania  (42 posts)  [Biography] bio
Date Fri 06 Aug 2004 01:46 AM (UTC)
Like I said on other posts, I know nothing about codding and scripting, so I will need full help. OK, here is my problem

In the mud I play, are quests - lol, like in many others. But here you have someone who hires you to retrieve a certain item. Those items are not unique, are to be find all over the place. The items are allways the same, could be pieces of armor, misc items, even food or light.
What I want is to make something that recognise the items on the ground or in mobs inventory and tells me "x - job item", or even better "x - job item for Y".
Of course, I can capture the description of each item and set some triggers, but it looks like a huge task, and must be an easyest way.
I realise I have to capture the description of the items when are laying on the ground, but having about 1000-1500 triggers just for this, don't look right.
Let me give you an example:
Is a mob, Chaste, who can hire you to retrieve: a platoon medpack, a ranger tool, an extractor, mountain ranger boots.
The ranger tool, when is on the ground is "A small black tool lies on the ground." When is in a mob inventory is a ranger tool" or the mob may held it then is "<held in hand> a ranger tool". To set 3 triggers for just 1 item... and are literally hundreds... hmm

I *think* a database or someting can be made, to hold all the items, and when I look/glance/peek at a mob or look/observe a room to see if the items there are to be found in the db.
Can be? :)

Thank you,

PS Guys, sometimes I'm tinking... if I would know all you know about scripting, triggers and stuff, my life on any mud would be a lot easyer. :)
[Go to top] top

Posted by Avariel   Portugal  (55 posts)  [Biography] bio
Date Reply #1 on Tue 17 Aug 2004 09:24 AM (UTC)

Amended on Tue 17 Aug 2004 09:33 AM (UTC) by Avariel

Im sure there the more recent versions of MC features DB options, but im not familiar with them yet, so I would use an array and world.AddTrigger function. I dont see how you can manage to do what you want without 2 triggers for each item though ( not 3 as you were thinking as the inventory, held or wear has the same desc if you use the right match ), you dont need to build those triggers by hand though.

i would build a solution like this ( example in JScript ):

var eEnabled = 1; // enable trigger
var eTriggerRegularExpression = 32; // trigger uses regular expression
var eReplace = 1024; // replace existing trigger of same name

var match  = new Array()

// match [i] = "ground desc|inventory desc|quest mob"

match [0]  = "A small black tool lies on the ground.|a ranger tool|Chaste"
match [1]  = "A big rock lies on the ground.|a big rock|mason"

for ( i = 0 ; i < match.length ; i++ ) {

    var list = match[i].split("|"); // splits each match line in the 3 parts that we want
    var send_  = list [1] + " - job item for " + list [2] // creates the note "x - job item for Y"
    var flags_ = eEnabled | eTriggerRegularExpression | eReplace;
// AddTrigger(TriggerName, MatchText, ResponseText, Flags, Colour, Wildcard, SoundFileName, ScriptName);

    world.addtrigger( "Quest_G" + i , list [0] , send_ , flags_ , -1 , 0 , "" , "" );
    world.addtrigger( "Quest_I" + i , list [1] , send_ , flags_ , -1 , 0 , "" , "" );
    world.settriggeroption ( "Quest_G" + i , "send_to", 2 ); // set the trigger to send as note
    world.settriggeroption ( "Quest_I" + i , "send_to", 2 ); // set the trigger to send as note

The Avariel Wind Lord
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #2 on Tue 17 Aug 2004 09:38 AM (UTC)
Mushclient has no real database functions inbuilt.

It relys completely on the script languages for that, which is very versatile. (depending on which language you know/want to know/are learning whatnot, the approach is different). But you can check the mud database plugin for examples on using databases.

You wont be able to get away with much of anything, except tons and tons of triggers.
However, you CAN use scripting and a database. In many ways, your best bet would probably be to add appropriate triggers as per quests (three per item, or even one per item) which you then delete once youve found the item. And keep another database of what you need, and who the quest is for.

You could get away with a single trigger (and variable) per item, but it would probably be easiest and most versatile to add a trigger for each way of finding the item, that way you know if its on a mob, or on the ground, or whatnot, and can take steps accordingly.

But theres no reason to have triggers active for items that you dont need all the time. You can add/delete them just as easily as turn them on or off, and it would clean up your world file.


Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #3 on Tue 17 Aug 2004 09:22 PM (UTC)
I would have 3 triggers, one for ground, one for inventory and one for held, and then do the rest via scripting, much like Avariel suggested, but instead of adding triggers, just using the for loop to check through each item and print the appropriate job.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[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.


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.


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]