↓ Skip to main content

zmud scripting help wanted

·606 words·3 mins

I know the string, and need to “analyze” next one. Depends of what following string contains zmud should take different actions.

Let me explain in example:

Leizu is a druid prime. <- this string comes from the mud and never changes. I need to check next, rigth after this one.

next string may contain 3 variants:

  1. druid <- zmud should say cool

  2. mage <- zmud should say comfort

  3.       <- (empty string) zmud should be silent
    

P.S. atm I use zMUD 4.62

I don’t use zMUD, but probably works the same way as my client.. or can be adjusted accordingly.. trigger on

[code:27v4zwxl]

  • is a * prime.

[/code:27v4zwxl]

which sends %2 to the subroutine script (zMUD has scripting, right?) that says

[code:27v4zwxl]

sub Leizuscript (strTriggerName, trig_line, arrWildCards)

dim class

  class = arrWildCards (1)

      if class = ("druid") then

          World.send "say cool"

      end if

      if class = ("mage") than

          World.send "say comfort"

      end if

end sub

[/code:27v4zwxl]

or something like that anyway heh

prolly I gave bad example. I’m not good in coding, so prolly missing something or understand in a wrong way.

those strings are not related anyhow except second goes right after first. hehe.

lets say first string is not ‘Leizu is a druid prime’, but ‘asdfsdfsdfasdfsdfs’.

I’m using zMUd 5.55 here.

Lets say mud output is like so:

<726hp 350ma 177mv>

cast ‘Aegis’ Zenkai

You weave the threads of magic masterfully!

You are surrounded by a radiant light.

<726hp 311ma 177mv>[/color:5xkxx084]

And you want to trigger a command if you cast a masterful aegis.

[code:5xkxx084]trigger:

^<hpma*mv>

command:

#var magic 0

trigger:

^You weave the threads of magic masterfully!

command:

#var magic 1

trigger:

^You are surrounded by a radiant light.

command:

#if (@magic = 1) {say Alright! Masterful Aegis!}[/code:5xkxx084]

Is that something like what you want to script?

thanks Zenkai, I’ll keep it in mind. this one might be useful.

btw zmud stores 3 last strings in variables what could be very useful for masterful cast detection. I tried to use it for this case, but empty string didnt let me make it done at first sight.

I use ZMud v4.62 too, and Ive solved such a problem this way:

there are two strings: string1 and string2

we need to do something on string2 if it follows string1

the triggers are like this

class: checkstring1

pattern: string1

#T+ checkstring2;#t- checkstring1

class: checkstring2

pattern: %1

#IF {%1=@variant1} {command1;#T- checkstring2;#T+ checkstring1};

#IF {%1=@variant2} {command2;#T- checkstring2;#T+ checkstring1};

#IF {%1<>’’} {#T- checkstring2;#T+ checkstring1}

Can turn off the checkstring2 trigger on prompt,

like: Pattern: , command: #T- checkstring2

I know it looks ugly, it smells bad, but its about to work..similiar code has worked for me..in the recasting spells trigger, I think.

Teron

P.S. ZMud v4.62 is way better than any other version of ZMud.

Newbies!

There is o­ne easy way to solve the problem, if there are not much variants of second string.

You can set up multiline triggers. It can be done this way:

1st trigger:

Trigger pattern: ^Leizu is a druid prime$^Leizu is a druid

Trigger text: #say cool

2nd trigger:

Trigger pattern: ^Leizu is a druid prime$^Leizu is a mage

Trigger text: #say crap

This is it. It should work o­n zmud 4.62 as well.

So, in addition to it, if you need to analyze the second string you will write a trigger like this:

^Leizu is a druid prime$^%1$

and you will have all the second string in your %1 variable

zmud 4.62 doesnt support multiline triggers, newbie :)

Hehe, my fault, my memory is playing tricks with me, was using zmud 4.62 too long ago. Then i suppose Terons triggers should be working fine.