Page 1 of 2

Individual Commands

Posted: June 5th, 2015, 7:35 am
by SomeRandomGuy12
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?

Re: Individual Commands

Posted: June 5th, 2015, 7:43 am
by Immortalbob
Theres a couple ways to do it, you can set your characters up with variables through expressions, or you can use item inventory count.

Re: Individual Commands

Posted: June 5th, 2015, 1:48 pm
by SomeRandomGuy12
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.

Re: Individual Commands

Posted: June 5th, 2015, 4:04 pm
by yaroz
It's not currently possible, but Virindi has several people that have made the request.

Re: Individual Commands

Posted: June 5th, 2015, 4:25 pm
by SomeRandomGuy12
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?

Re: Individual Commands

Posted: June 5th, 2015, 6:44 pm
by HellsWrath
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.

Re: Individual Commands

Posted: June 5th, 2015, 8:57 pm
by SomeRandomGuy12
Concise and to the point, thanks for the clarification, appreciate it!

Re: Individual Commands

Posted: September 12th, 2016, 6:54 am
by SomeRandomGuy12
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,

Re: Individual Commands

Posted: September 12th, 2016, 8:34 am
by Dmdtt
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

Re: Individual Commands

Posted: September 12th, 2016, 8:56 am
by SomeRandomGuy12
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,