I'm playing a MUD where commodities have a short name such as "iron" and a long name such as "an iron ore". You can get these from infiltrating legions, and I have a basic alias/trigger combo set up to do this, but I have to manually change the commodity type in the trigger, which I'd rather streamline.
I don't know the best way to do this, maybe a variable table? I'm a newcommer to Mudlet and don't really know much about scripting, but if anyone has any ideas or can help that'd be great.
Here's what I have so far. The bolded parts are an example of the variance between the commodity/item labels. I'd like to somehow be able to set the commodity longname to a variable which can be used alongside the shortname, something where "some refined spice" and "spice" are equivalent and interchangeable?
Alias: ^i (dye|wood|salt|gold|silver|wool|iron|tin|bronze|marble|gem|leather|silk|flint|rope|yarriol|spice)$
send("infiltrate "..t.." "..matches[2] )
echo("Infiltrating for: "..matches[2])
Trigger: Your infiltration of the corps "(.*)" is successful and you pilfer some refined spice
send("open pack ")
send("put spice in pack ")
send("close pack ")
send("infiltrate "..t.." spice ")
send("who ")
Working with Multiple Variables
-
- Posts: 97
- Joined: Wed Jul 25, 2012 12:35 pm
Re: Working with Multiple Variables
(^(|> )Trigger: Your infiltration of the corps "(.*)" is successful and you pilfer some (refinded|unrefined) (.*)$)
send("open pack ")
send("put "..matches[6].." in pack ")
send("close pack ")
send("infiltrate "..matches[6])
send("who ")
cecho("\n<red>"..matches[6])
send("open pack ")
send("put "..matches[6].." in pack ")
send("close pack ")
send("infiltrate "..matches[6])
send("who ")
cecho("\n<red>"..matches[6])
English is not my native language. If you don't understand what im writing ask.
Ubuntu 17.04, Mudlet 3.1
Ubuntu 17.04, Mudlet 3.1
-
- Posts: 2
- Joined: Fri Jul 22, 2016 9:25 pm
Re: Working with Multiple Variables
This doesn't work, I'm assuming because of the inability to use the various item long names and item tags interchangeably.
Example:
iron = some iron ore
wax = some wax
flint = a flint stone
And many more. I'm trying to figure out a way that will allow the trigger to recognize the long name and perform the action using the short name.
Example:
iron = some iron ore
wax = some wax
flint = a flint stone
And many more. I'm trying to figure out a way that will allow the trigger to recognize the long name and perform the action using the short name.
-
- Posts: 97
- Joined: Wed Jul 25, 2012 12:35 pm
Re: Working with Multiple Variables
(^(|> )Trigger: Your infiltration of the corps "(.*)" is successful and you pilfer (.*)\.$)
if matches[5] == "some iron ore" then ResourcesVariable = "iron ore" end
if matches[5] == "some wax" then ResourcesVariable = "wax" end
if matches[5] == "a flint stone" then ResourcesVariable = "flint" end
send("open pack ")
send("put "..ResourcesVariable.." in pack ")
send("close pack ")
send("infiltrate "..ResourcesVariable)
send("who ")
cecho("\n<red>"..matches[5])
if matches[5] == "some iron ore" then ResourcesVariable = "iron ore" end
if matches[5] == "some wax" then ResourcesVariable = "wax" end
if matches[5] == "a flint stone" then ResourcesVariable = "flint" end
send("open pack ")
send("put "..ResourcesVariable.." in pack ")
send("close pack ")
send("infiltrate "..ResourcesVariable)
send("who ")
cecho("\n<red>"..matches[5])
English is not my native language. If you don't understand what im writing ask.
Ubuntu 17.04, Mudlet 3.1
Ubuntu 17.04, Mudlet 3.1
Re: Working with Multiple Variables
You could use a table with the long description as keys.