CMUD/ZMUD Script Samples

Need some help with your MUD client? Forgot your password? Get help here.
Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Bromen
Champion
Posts: 678
Joined: 04 Mar 2010 06:29

Re: CMUD/ZMUD Script Samples

Post by Bromen » 21 Oct 2012 04:29

Love this. Solved the spam issues I had with in game chat.

Thanks!

-B

User avatar
Rhaegar
Legend
Posts: 960
Joined: 13 May 2010 06:22

Re: CMUD/ZMUD Script Samples

Post by Rhaegar » 21 Oct 2012 12:32

Some of the more common/important things missing in original Earth's post would be patterns for elemental and morgul ventriloquism. Why only include psuchae and PoT?
I fear no evil for I am fear incarnate.

Bromen
Champion
Posts: 678
Joined: 04 Mar 2010 06:29

Re: CMUD/ZMUD Script Samples

Post by Bromen » 23 Oct 2012 05:55

is there a way to capture more characters in the separate window?

-b

User avatar
Cherek
Site Admin
Posts: 2790
Joined: 04 Mar 2010 04:36

Re: CMUD/ZMUD Script Samples

Post by Cherek » 23 Oct 2012 08:34

bromen wrote:is there a way to capture more characters in the separate window?

-b
Did you try my way of doing it? (scroll down to the bottom)

http://www.genesismud.org/forums/viewto ... =14&t=2004

Icarus
Veteran
Posts: 244
Joined: 04 Dec 2012 20:54

Re: CMUD/ZMUD Script Samples

Post by Icarus » 05 Dec 2012 12:36

Ok, questions (trying to get back some of the things I once had, and knew):

I'm using zMud, but most functions should be similar to cMud.

Question 1:
#TR "You slam * %w" {
???
}

Result I want:

You slam hideous nasty goblin weakly in the chest.
display:
You slam hideous nasty goblin weakly in the chest. (WEAKLY)
instead of the usual I manage:
You slam hideous nasty goblin weakly (WEAKLY) in the chest.
or
You slam hideous nasty goblin WEAKLY in the chest.

I want the first one, thus prefferably without SU'ing the whole line, I know this should be possible.

Question 2:

variable string or dbase (two column corresponding string)

var1 (or column1) var2 (or column2)
jack & jill fairytale
gene & paul kiss
john & ringo beatles

now; the usage:

#tr {@var1} {
#echo @var2 - corresponding value
}

Giving me "jack & jill" returning with "fairtytale", "gene & paul" returning with kiss, "john & ringo" returning with beatles..

I know this is possible, since I've had it before, but in 9 years or so since I made it, it's been... forgotten, and the files are long since lost in various disk crashes and computer replacements.

Ic, Crystalsword of Calia

Einar
Apprentice
Posts: 41
Joined: 29 Mar 2012 13:44

Re: CMUD/ZMUD Script Samples

Post by Einar » 15 May 2013 21:32

Icarus wrote:Ok, questions (trying to get back some of the things I once had, and knew):

I'm using zMud, but most functions should be similar to cMud.

Question 1:
#TR "You slam * %w" {
???
}

Result I want:

You slam hideous nasty goblin weakly in the chest.
display:
You slam hideous nasty goblin weakly in the chest. (WEAKLY)
instead of the usual I manage:
You slam hideous nasty goblin weakly (WEAKLY) in the chest.
or
You slam hideous nasty goblin WEAKLY in the chest.

I want the first one, thus prefferably without SU'ing the whole line, I know this should be possible.

Question 2:

variable string or dbase (two column corresponding string)

var1 (or column1) var2 (or column2)
jack & jill fairytale
gene & paul kiss
john & ringo beatles

now; the usage:

#tr {@var1} {
#echo @var2 - corresponding value
}

Giving me "jack & jill" returning with "fairtytale", "gene & paul" returning with kiss, "john & ringo" returning with beatles..

I know this is possible, since I've had it before, but in 9 years or so since I made it, it's been... forgotten, and the files are long since lost in various disk crashes and computer replacements.

Ic, Crystalsword of Calia
Right, in Cmud answer for first question is very easy:
#sayadd {(Weakly)}
Second one is more complicated but I've done my best:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger priority="20770" regex="true">
<pattern>\b(%eval(%dbkeys(test)))\b</pattern>
<value>$t = {%1}
#print %db(@test,$t)</value>
</trigger>
<var name="test" type="Record">
<value>jack & jill=fairytale|john & ringo=beatles|gene & paul=kiss</value>
<json>{"gene & paul":"kiss","jack & jill":"fairytale","john & ringo":"beatles"}</json>
</var>
</cmud>
If my assumption is wrong and you haven't migrated from zmud to cmud those answers will be useless for you as it won't work in zmud.

Icarus
Veteran
Posts: 244
Joined: 04 Dec 2012 20:54

Re: CMUD/ZMUD Script Samples

Post by Icarus » 15 May 2013 22:02

Ow, well, the sayadd part whas what I was looking for, thanks a BUNCH Einar, second one I solved with Jooli to help me, a while back, and yes, I'm on CMud now ^^
Flee you fools!

Dread
Great Adventurer
Posts: 188
Joined: 12 Mar 2010 23:53

Re: CMUD/ZMUD Script Samples

Post by Dread » 25 Dec 2014 02:07

Earth wrote:
bromen wrote:Earth,

Is it a trigger alias or something else? I have the latest version of Cmud and the only thing I really ever needed was some sort of chat filter so I'm really hoping this can solve a ton of problems for me.

Thanks,

Bromen
To use the CMUD version in the initial post of the form, all you have to do do is to save the code into an .xml file. Then from inside the trigger settings, just import the file. Doing so will give you the full functionality of the code available in my library currently.
Is anyone around anymore with some Cmud knowledge they wouldn't mind sharing? I am just recently returned, and using a licensed copy of Cmud 3.34. I followed these, extremely simple I know, instructions and yet I can get nothing to work. I can create basic triggers, aliases etc, but this script is a bit beyond me. I also tried just doing the simple zmud version and nothing happened there as well. I would also love to know how to create health/mana/exhaustion bars.

Icarus
Veteran
Posts: 244
Joined: 04 Dec 2012 20:54

Re: CMUD/ZMUD Script Samples

Post by Icarus » 25 Dec 2014 15:46

Dread:

Health / Mana / Exhaust:

Code: Select all

<class name="Bars" id="9654">
  <var name="my_fatigue" id="9655">
    <value>extremely alert</value>
    <json>extremely alert</json>
  </var>
  <var name="my_hp" id="9656">
    <value>feeling very well</value>
    <json>feeling very well</json>
  </var>
  <var name="value_of_my_hp" id="9657">11</var>
  <button type="Gauge" autosize="false" width="240" height="20" autopos="false" left="627" top="-1" color="lime" gaugelowcol="red" gaugebackcol="white" priority="12869" id="9658">
    <caption>%upper(@my_hp)</caption>
    <expr>@value_of_my_hp</expr>
    <gaugemax>11</gaugemax>
    <gaugelow>5</gaugelow>
  </button>
  <trigger type="GMCP" priority="13410" id="9659">
    <pattern>Char.Vitals</pattern>
    <value>#Class Bars
my_fatigue = {%gmcp.Char.Vitals.Fatigue}
my_hp = {%gmcp.Char.Vitals.Health}
my_mana = {%gmcp.Char.Vitals.Mana}
#switch (@my_hp=="at death's door") {value_of_my_hp=1} (@my_hp=="barely alive") {value_of_my_hp=2} (@my_hp=="terribly hurt") {value_of_my_hp=3} (@my_hp=="in a very bad shape") {value_of_my_hp=4} (@my_hp=="in a bad shape") {value_of_my_hp=5} (@my_hp=="very hurt") {value_of_my_hp=6} (@my_hp=="feeling rather hurt") {value_of_my_hp=7} (@my_hp=="hurt") {value_of_my_hp=8} (@my_hp=="somewhat hurt") {value_of_my_hp=9} (@my_hp=="slightly hurt") {value_of_my_hp=10} (@my_hp=="feeling very well") {value_of_my_hp=11}
;my_hp = %replace(%1,"feeling","")
#switch (@my_mana=="in a vegetable state") {value_of_my_mana=0} (@my_mana=="exhausted") {value_of_my_mana=1} (@my_mana=="worn down") {value_of_my_mana=2} (@my_mana=="indisposed") {value_of_my_mana=3} (@my_mana=="in a bad shape") {value_of_my_mana=4} (@my_mana=="very degraded") {value_of_my_mana=5} (@my_mana=="rather degraded") {value_of_my_mana=6} (@my_mana=="degraded") {value_of_my_mana=7} (@my_mana=="somewhat degraded") {value_of_my_mana=8} (@my_mana=="slightly degraded") {value_of_my_mana=9} (@my_mana=="in full vigour") {value_of_my_mana=10}
;my_mana = %replace(%1,"in","")
#switch (@my_fatigue=="extremely alert") {value_of_my_fatigue=20} (@my_fatigue=="very alert") {value_of_my_fatigue=19} (@my_fatigue=="alert") {value_of_my_fatigue=18} (@my_fatigue=="somewhat alert") {value_of_my_fatigue=17} (@my_fatigue=="slightly alert") {value_of_my_fatigue=16} (@my_fatigue=="slightly weary") {value_of_my_fatigue=15} (@my_fatigue=="somewhat weary") {value_of_my_fatigue=14} (@my_fatigue=="weary") {value_of_my_fatigue=13} (@my_fatigue=="very weary") {value_of_my_fatigue=12} (@my_fatigue=="extremely weary") {value_of_my_fatigue=11} (@my_fatigue=="slightly tired") {value_of_my_fatigue=10} (@my_fatigue=="somewhat tired") {value_of_my_fatigue=9} (@my_fatigue=="tired") {value_of_my_fatigue=8} (@my_fatigue=="very tired") {value_of_my_fatigue=7} (@my_fatigue=="extremely tired") {value_of_my_fatigue=6} (@my_fatigue=="slightly exhausted") {value_of_my_fatigue=5} (@my_fatigue=="somewhat exhausted") {value_of_my_fatigue=4} (@my_fatigue=="exhausted") {value_of_my_fatigue=3} (@my_fatigue=="very exhausted") {value_of_my_fatigue=2} (@my_fatigue=="extremely exhausted") {value_of_my_fatigue=1}
#Class 0</value>
  </trigger>
  <button type="Gauge" autosize="false" width="240" height="20" autopos="false" left="1110" top="0" color="lime" gaugelowcol="red" gaugebackcol="white" priority="12866" id="9660">
    <caption>%upper(@my_fatigue)</caption>
    <expr>@value_of_my_fatigue</expr>
    <gaugemax>20</gaugemax>
    <gaugelow>6</gaugelow>
  </button>
  <var name="my_mana" id="9664">
    <value>in a bad shape</value>
    <json>in full vigour</json>
  </var>
  <var name="value_of_my_mana" id="9665">4</var>
  <var name="value_of_my_fatigue" id="9666">20</var>
  <button type="Gauge" autosize="false" width="242" height="20" color="aqua" gaugelowcol="red" gaugebackcol="#F0F0F0" priority="12872" id="9667">
    <caption>%upper(@my_mana)</caption>
    <expr>@value_of_my_mana</expr>
    <gaugemax>10</gaugemax>
    <gaugelow>4</gaugelow>
  </button>
</class>
Flee you fools!

Dread
Great Adventurer
Posts: 188
Joined: 12 Mar 2010 23:53

Re: CMUD/ZMUD Script Samples

Post by Dread » 25 Dec 2014 18:23

Thank you very much Icarus!

I copied that code, pasted it into notepad++, saved it as xml and then imported it into Cmud. It worked great! I did the same thing with Earth's code and it does nothing
however. Is there another step I need to do there?

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/