Individual Commands

Unofficial support for the creating and editing of metas.
SomeRandomGuy12
Posts: 13

Individual Commands

Post #1 »

First time poster, long time lurker. :)

I am looking for some guidance/strategy tips for changing my command meta. Basically what I would like it do
do is be able to only have an individual member of my fellow to respond to a command. Something like

Anyone says: NameOne use ItemName

Which would trigger an action for Only the character named "NameOne" to use the item named "ItemName".

Any suggestions for a suitable approach?

User avatar
Immortalbob
Site Admin
Posts: 676
Contact:

Post #2 »

Theres a couple ways to do it, you can set your characters up with variables through expressions, or you can use item inventory count.
Immortalbob of MT

SomeRandomGuy12
Posts: 13

Post #3 »

Thank you for the reply, I am leaning more towards using variables/expressions I guess. I want to make it as flexible as possible, not having to rely on inventory items.

Is it possible to find a way to do something like this?

Someone says "Myname use lever"
Parse string to string1, string2, string3

If Myname=string1 then setvariable listening=1
If listening=1 and string2=use then /say /mt use string3
Set resultcode=1 if success, set resultcode=0 if fail.
If resultcode=1, set listening=0

As you might have guessed I am absolutely terrible at programming, last time I wrote code, it was ASM on 68K, but I hope you get an idea of what I mean.

yaroz
Moderator
Posts: 129

Post #4 »

It's not currently possible, but Virindi has several people that have made the request.

SomeRandomGuy12
Posts: 13

Post #5 »

That give me some hope at least, thank you! :)

It's as the RegEx User Guide page said. I am currently feeling a slight headache trying to wrap my head around
how to parse a string and using it to set variables.

I have been looking at this example
"# split on simple space
string "aaa bbb ccc"
re = \S+
result = "aaa", "bbb", "ccc""

But headache started when I tried figuring out how to make it in to variables, glad someone stopped me before it got worse :)

What is is that others have requested more specifically, is there a tracking number I could look at?

User avatar
HellsWrath
Site Admin
Posts: 389

Post #6 »

SomeRandomGuy12 wrote:That give me some hope at least, thank you! :)

It's as the RegEx User Guide page said. I am currently feeling a slight headache trying to wrap my head around
how to parse a string and using it to set variables.

I have been looking at this example
"# split on simple space
string "aaa bbb ccc"
re = \S+
result = "aaa", "bbb", "ccc""

But headache started when I tried figuring out how to make it in to variables, glad someone stopped me before it got worse :)

What is is that others have requested more specifically, is there a tracking number I could look at?

Parsing a string and adding a portion to a variable is not currently possible, no matter the regex. That is the request.
Use the decal forums for feature requests.

SomeRandomGuy12
Posts: 13

Post #7 »

Concise and to the point, thanks for the clarification, appreciate it!

SomeRandomGuy12
Posts: 13

Post #8 »

Sorry for bringing this old thread back to ,ehm, life.

Considering the recent addition of http://www.virindi.net/wiki/index.php/M ... _Condition

Would this be possible now using the ChatMessageCapture ?


Rgds,

Dmdtt
Moderator
Posts: 271

Post #9 »

yes it would. lets for example say the command you wish to trigger off of is this

Bdf says, "!Dweia use Burning Coal"

first you would need to setup a capture, since you it is from one of your characters make sure the chat capture condition is in an All with a regex to limit only your character commands getting capture something like this

Code: Select all

Chat: (^(\[[A-z]+?\] |)You|.*\<Tell:IIDString:.+:(Char1|Char2|Char3)\>.+\<\\Tell\>) (say|says|tells you), \"!.*\"$
then after that is added to the all make the capture

Code: Select all

ChatCap  (^(\[[A-z]+?\] |).*\<Tell:IIDString:.+:((?<tellchar>[^\<]*))\>.+\<\\Tell\>) (say|says|tells you), \"!(?<telltextone>.*) use (?<telltexttwo>.*)\"$
now this capture will only work for issuing a command for 1 character to use a specific item, npc or other named object. it will save 3 separate capturegroups when issued the command above, which will be equal to

getvar[capturegroup_tellchar]==Bdf

getvar[capturegroup_telltextone]==Dweia

getvar[capturegroup_telltexttwo]==Burning Coal

then in a separate rule in the condition compare the newly made variable with getcharstringprop[1] to make sure it matches the issued characters name so only the commanded character will use the item

Code: Select all

Expr getcharstringprop[1]==getvar[capturegroup_telltextone]
only Dweia in our example would trigger off the above condition and then go through with the action below

Code: Select all

ExprAct actiontryuseitem[wobjectfindininventorybynamerx[getvar[capturegroup_telltexttwo]]];clearvar[capturegroup_telltexttwo];clearvar[capturegroup_telltextone];clearvar[capturegroup_tellchar]
this will both execute the command then clear all of the captured variables.

Edit: fixed ChatCap condition regex

SomeRandomGuy12
Posts: 13

Post #10 »

I will have a go and see what I can come up with. This addition (and more importantly, your elaboration!) is just phenomenal!

Now I just have to try and refrain myself from trying to make all sorts of crazy stuff.

Thank you!!

Rgds,