CMud Scripting

24

Comments

  • SelthisSelthis Member Posts: 524 ✭✭✭✭✭
    Moving it to a different class apparently made it work.  I have no clue why, but it does. Thanks to Dicene and Aulani
  • GurnGurn Member Posts: 787 ✭✭✭✭
    Not so much a scripting issue as a couple bugs: When I start Cmud, it always turns num lock on my laptop. I have no idea why, but it's annoying. When I start it up, despite the fact that I paid for it and put in a legit licence key, it'll always tell me I'm running a trial version at 30 days evaluation. Does anyone know why these problems happen?
  • AzefelAzefel SingaporeMember Posts: 730 ✭✭✭✭
    edited February 2013
    go to cmud Prefs, by default it'll be on the User Interface, Command Line tabs. There's a checkbox for "activate numlock". Uncheck/check it as you like.

    image
    image
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    For the license issue, the best I think you could do is save all settings/modules/layouts/etc and reinstall. If that doesn't clear it up, you've probably got something in your registry screwing you over.
    image
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    edited February 2013
    Selthis wanted something to toggle Timestamp. Alias and Button code below. Heads up, alias always toggles right, but the button will lose sync with whether or not timestamps are showing or not if you use the alias as well. Just press the button twice and problem solved.
    #ALIAS toggletstamp {#IF (%pref(showtime)) {#CALL %pref(showtime,0)} {#CALL %pref(showtime,1)}}
    
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <cmud>
      <button name="TimestampToggle" type="Toggle" priority="33500" copy="yes">
        <caption>TStamp</caption>
        <value>#CALL %pref(showtime,1)</value>
        <button>
          <caption>TStamp</caption>
          <value>#CALL %pref(showtime,0)</value>
        </button>
      </button>
    </cmud>
    
    
    Edit: It made actual buttons on the forum...what?
    image
  • GurnGurn Member Posts: 787 ✭✭✭✭
    I'm attempting to get a channel capture thing going, but it keeps cutting off after the first line. I can't figure out how to set it so that it just captures the entire tell/say up until the prompt. Currently, I'm just using #trigger {tells you,} {#CAP Tells}
  • LionasLionas Member, Historian Posts: 765 ✭✭✭✭✭
    I use a trigger state of (?)*, checking the first character of the line with the first character of my prompt. If I don't find it, I want to keep capturing, so I #state to keep within the capture
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • GurnGurn Member Posts: 787 ✭✭✭✭
    So it'd be something like #trigger {tells you,} {#CAP Tells};#Cond {<%1/%2h} {#state 0}?
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    edited February 2013
    Another option is CONFIG WRAPWIDTH 0 and switching to clientside wrapping. I prefer it because never dealing with newlines again is a beautiful thing, but if you've got a lot of triggers set up with newlines accounted for already, the transition is rough. As far as Lionas' method goes, I think he's matching everything with the (?)* and checking if %1 = "<". If it doesn't, it gets capped and state is set to 2(whichever one the capture all state is, not sure if #state is zero-based) until it finally catches a prompt, at which point it goes back to state 1 to wait for a new tell.

    Edit: I'm on my phone or else I would write an example out.
    image
  • LionasLionas Member, Historian Posts: 765 ✭✭✭✭✭
    edited February 2013
    Just got home from work. Here's an example.

    #trigger tellcap {^{%w|A masked man|A masked woman} tells you,{ in %w,|} "*} {#cap communication;#beep;#alarm {+0.5} {#beep}}
    #cond {(?)*} {#if (%string(%1) = "<") {#state tellcap 0} {#cap communication;#state tellcap 1}}


    EDIT: I keep meaning to switch to wrapwidth 0, but Lio has 7 years of legacy code just for him, plus some older stuff. :effort:
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    WRAPWIDTH 0 has some disadvantages. Client wrapping is keeping me from having a condensed summary of everything to the right of the 80 margin.
    image
  • CadeyrnCadeyrn Member Posts: 188 ✭✭✭
    My legacy mudbot failing entirely with the changes in endurance/willpower - I think, I'm looking for some help starting a basic system to deal with the defences not covered by the autohealing.
    I'm hoping someone will be able to give me some pointers on starting a basic queue system for eq/balance.

    On a side note, I can't seem to get an #alarm to work for keeping pipes lit.
  • DelrayneDelrayne Member Posts: 457 ✭✭✭
    edited March 2013
    I just triggered the welcome to imperian message to do all the non eq/bal defenses not covered by auto curing with a temp timer or #wait for you for mindseye then triggered mindseye and each subsequent defense there after to queue eqbal defense, and on the last defense turn that trigger group off. So it doesn't auto reapply defenses. But as AM you rarely fight def strippers. What up priests and Templars.

    For the pipes I just triggered the pipes going out line to queue eqbal light pipes, as well as filling them with any plant to queue up lighting. It's not perfect by any means but it works for me until I take up the notion to perfect it.

  • SelthisSelthis Member Posts: 524 ✭✭✭✭✭
    Okay, not too long ago, this was working.  But now it is not.

    <trigger priority="26550" regex="true" id="101">
      <pattern>(\a+) tells you\, \"Pendant\.\"</pattern>
      <value>#if (%ismember(%1,@Pendantlist)) {
      generosity
      remove 102587
      beckon artifacts 1025087
      give 102587 to %1
      } {reply No Pendant for you!}</value>
    </trigger>

    I have a pendantlist variable in the same folder that is just a string list.   I know it worked in the past but I have no clue what changed now so it does not work. Any ideas?
  • AzefelAzefel SingaporeMember Posts: 730 ✭✭✭✭
    edited March 2013
    What doesn't work about it? Doesn't do anything? Or doesn't use  the proper name? Works on any name?

    using


      <trigger priority="26550" regex="true" copy="yes">
        <pattern>^(\a+) tells you, "Pendant\."$</pattern>
        <value>#if %ismember(%1,@Pendantlist) {
      generosity
      beckon artifact 1025087
      remove 102587
      give 102587 to %1
      } {reply No Pendant for you!}</value>
      </trigger>

    it worked on my end.as it should.
    image
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    I wanna point out that the item number is different in some of those commands. You're beckoning 1025087 but removing/giving 102587. I'm assuming that 0 in the beckon line is unnecessary.
    image
  • SelthisSelthis Member Posts: 524 ✭✭✭✭✭
    edited March 2013
    It is.  Faz helped me get it working.  For whatever reason, it was crapping if I include the ." part of the tell in the trigger.  No clue why.  Its only that trigger it craps on, but either way, its working now.

    Edit: And is correct in my trigger in cmud.  Odd.  Must have accidently hit it when I was making the post.
  • LabilLabil Member Posts: 355 ✭✭✭
    Cadeyrn said:
    My legacy mudbot failing entirely with the changes in endurance/willpower - I think, I'm looking for some help starting a basic system to deal with the defences not covered by the autohealing.
    If you know how to compile imts, or don't mind learning how to, the change to make imts work after the removal of end/will is pretty easy.
  • GurnGurn Member Posts: 787 ✭✭✭✭
    How does one copy/paste aliases to another session/package? And how do you group things into a package so it can be put into other sessions? 
  • LionasLionas Member, Historian Posts: 765 ✭✭✭✭✭
    Gurn said:
    How does one copy/paste aliases to another session/package? And how do you group things into a package so it can be put into other sessions? 
    Select the settings you want to copy, right click, select cut/copy. Click the class/session you want to put the in, and paste. To export settings to be imported in another session, select the setts or classes you want to export, right click, and select export to XML.
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • GurnGurn Member Posts: 787 ✭✭✭✭
    I tried the XML exporting, but it only did the triggers for some reason.

    And then it duplicated my aliases on my hunter system. I'm seriously confused on how that happened. Also, when I copied the settings onto my blank session, it just wouldn't use them.
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    Anyone aware of any issues with Expression Triggers? I've got some rather simple ones I'm trying to get to work and they just don't like me at all. Even my Status Window doesn't seem to always update when variables change. I can make a brand new, no frills trigger when @Stats/Bal gets updated(which is updated when the GMCP Char.Vitals is received) and it will run once when I save the trigger after making changes, then never again. I've been itching to expression triggers for a few different purposes, so any ideas at all at what might be the problem would be appreciated.
    image
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    edited April 2013
    Hate to double-post, but I'm having issues with something else. Between expression triggers not working but firing at completely random times to a trigger firing and doing the functional part of the trigger, but not echoing what it should be echoing, I'm thinking I need to just start a clean session and pull the things that work and are important over to it. Is there a quick, clean way to move stuff over without the worry of bringing corrupt triggers/aliases/etc over to the new session, or should I just manually rewrite my systems and take this opportunity to optimize stuff and make sure everything is working in the best way possible?

    Specifically, my newest problem is with grove return/gaze moradeim systems not echoing.

    One of the offending triggers. Still triggers and turns on autocuring and sets @grovereturning to 0, but doesn't actually activate the alarm alias like it should.

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <cmud>
      <trigger priority="42500" copy="yes">
        <pattern>^You hurl yourself head first into the %w and find yourself safely back within your grove.$</pattern>
        <value>ac on
    grovereturning = 0
    alarm green GROVE RETURN SUCCESSFUL!!!</value>
      </trigger>
    </cmud>

    Alarm alias is:

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <cmud>
      <alias name="alarm" copy="yes">
        <value><![CDATA[$colorback = 0
    $colorfore = 0
    $message = 0
    $len = 30
    #IF (%1="green") {$colorback = limegreen;$colorfore = lime}
    #IF (%1="red") {$colorback = orangered;$colorfore = red}
    #IF (%1="blue") {$colorback = royalblue;$colorfore = cyan}
    #IF ($colorback=0) {$colorback = %1;$colorfore = %2;$message = %-3} {$message = %-2}
    $mlen = %len($message)
    $padlen = %eval((24-$mlen)/2.0)
    ;#SAY padlen = $padlen, mlen = $mlen
    #IF (%mod($mlen,2)=1&&$len=30) {$len = $len + 1;$padlen = $padlen + 1}
    #IF (%len($message)>24) {$len = %len($message) + 6}
    #IF ($len>=85) {$len = 85}
    #SHOW <color $colorback>%repeat("*",$len)</color>%crlf<color $colorback>%if($mlen<80,"***")<color $colorfore>%repeat(" ",$padlen)$message%repeat(" ",$padlen)</color>%if($mlen<80,"***")</color>%crlf<color $colorback>%repeat("*",$len)</color>
    ;#SHOW $len Half: $mlen %eval($mlen/2)]]></value>
      </alias>
    </cmud>

    The alarm still works when I use it manually. Output will be pretty much this:

    ********************************
    ***GROVE RETURN SUCCESSFUL!!!***
    ********************************

    Edit: Sorry for the wall of text. =/ I want to notice, I've not messed with any of these triggers/aliases at all today and they were working just fine this morning. Closed and restarted CMUD and it's still not working right.
    image
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    Third post in a row. Sorry that I suck. Anyway, I'm thinking it's just some kind of issue with my session. Changed the trigger to #SHOW blah;#SAY blah;alarm green blah;#SHOW blah;#SAY blah to test out what it isn't doing correctly. When I grove return successfully and it triggers in a real situation, the two SAY's show up, but the SHOW's and alarm don't. When I use #SHOW to trigger it manually, it messes up the same way. When I use #SAY to trigger it or right click the trigger and EXECUTE SCRIPT, it works perfectly and shows the SHOW, SAY, alarm, SHOW, and SAY. I then tested the same triggers and alias in a blank, new session and it worked fine. I individually disabled all of my classes and triggers, and tried it in my normal session, and it is still broken. Only thing I can think of would be my session being corrupt or something in some way. I guess I'll be moving over to a clean new session. Hopefully, this will fix my Expression Trigger woes as well. Still, if anyone has any insight into my problems or maybe has experienced this before, I'd love any kind of information you might have for me.
    image
  • ChaniChani Member Posts: 8
    Selthis said:
    That's just it.  Its not firing at all.   That is what I can't figure out

    Edit:

    <trigger priority="2380" id="238">
      <pattern>^Your keen senses notice a single shard flying towards</pattern>
      <value>#EC Hi
    #Co 492
    </value>
    </trigger>

    Is the XML
    when i want to use an echo which i think your trying to as well, i use #echo "something" and for color text i use #cw 492
  • ChaniChani Member Posts: 8
    Okay trying to get something rather simple i think in my cmud.

    I would like 2 status lines where one shows my current gold, and the other is for the credits i can afford, so lets say i would like to buy credits at a maximum price of 8000 i would set that price, and then the cmud should some how figure out how much gold i have, and divide the amount with 8000 and then add the result in the status line.

    Anyone who could help me with this ?
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    If you wanted it to always show, you'd have to track how much gold you have. Best way is to track gold would be to have triggers for dropping, getting, giving, being given gold, as well as when you buy things. Since you don't see exactly how much you pick up while bashing, you could check INVENTORY BLAHBLAHBLAH so you just see what you're wielding, and your rift and gold, then update it each time that line is seen. After that, you'd make a StatusBar or StatusWindow that's something along the lines of "Gold: @gold (%eval(@gold/8000)C)". That should do it.
    image
  • KarandynKarandyn Member Posts: 4
    Not so much a scripting question. When I try to use the mapper in CMUD (V2, 2.37), during the configuration setup when you select what it scans each room for, it ALWAYS causes the program to stop responding when Next is clicked. Has anyone else run into this issue?
  • AzefelAzefel SingaporeMember Posts: 730 ✭✭✭✭
    please update cmud to v3.34.

    v3.xx is sooooo much better than v2.xx. Though it also uses a different license key and by now the time may have passed to get a free/discounted upgrade.
    image
    Dicene
  • DiceneDicene Member Posts: 913 ✭✭✭✭
    edited May 2013
    @Cadeyrn You asked (ages ago) for a simple queueing system to queue defs and the like. I use this for defences and as a basis for my combat, although queueing that far ahead in combat is a bad thing for bad players. I've got a seperate window that I cap a lot of random stuff in, that's why I'm capping things with #WIN Stuff. Feel free to change those to ECHO/SHOW/SAY, or just remove them. I've also got unnecessary commented lines in balance recovery that I used to debug. Feel free to remove those as well. I think those vars are BAL1 and EQ1 instead of BAL and EQ is because other triggers were messing with them. Also, change the prompt trigger to whatever your prompt looks like. Example of me deffing is below the code itself. Some of the short names in the defing alias are aliases that I've defined IG. Last but not least, \ is my separator, change to suit yours. (Yes, I know I should make a better one like \\ or || or |doThisToo| but I never feel like going back through my stuff to change it all.)

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <cmud>
      <class name="EQBal" copy="yes">
        <alias name="oneb" copy="yes">
          <value>#IF (!%1) {#WIN Stuff %ansi(brown)onEQBal: %ansi(gray)%numitems(@EQBalStack) item~(s~) in stack. %ansi(cyan)oneqbal list%ansi(reset)%ansi(gray) to list them.;#EXIT}
    #IF (%1 = list) {#WIN Stuff %ansi(brown)onEQBal: %ansi(gray)Listing command stack.;$i = 0;#FORALL @EQBalStack {$i = $i + 1;#WIN Stuff %ansi(brown)"   "$i~. %ansi(gray)%i};#EXIT}
    #IF (%1 = clear) {$oneqbalLen = %numitems(@EQBalStack);EQBalStack = %null;#WIN Stuff %ansi(brown)onEQBal: %ansi(gray)Stack cleared~($oneqbalLen items destroyed~);#EXIT}
    #IF (%1 = push) {EQBalStack = %push(%-2, @EQBalStack);#EXIT}
    #WIN Stuff %ansi(brown)onEQBal: %ansi(gray)~"%-1~" added to end of stack.
    EQBalStack = %additem(%-1, @EQBalStack)<;/value>
        </alias>
        <var name="EQBalStack" copy="yes"/>
        <trigger priority="45060" copy="yes">
          <pattern>You have recovered balance.</pattern>
          <value><![CDATA[;#SAY BAL!!! @EQBal/Bal1
    EQBAL/Bal1 = 1
    #IF ($bal&&$eq&&@eqbalStack) {%exec(%pop(@eqbalStack))}]]>;</value>
        </trigger>
        <trigger priority="45060" copy="yes">
          <pattern>You have regained your mental equilibrium.</pattern>
          <value><![CDATA[;#SAY EQ!!! @EQBal/EQ1
    EQBAL/EQ1 = 1
    #IF ($bal&&$eq&&@eqbalStack) {%exec(%pop(@eqbalStack))}]]>;</value>
        </trigger>
        <trigger name="promptTrigger" priority="100" newline="false" prompt="true" copy="yes">
          <pattern><![CDATA[^<(%d)/(%d)h (%d)/(%d)m (%d)b {%d%w |}<([e-])([b-])(*)>{ <%d %d>|}> (%d.%d)]]></pattern>
          <value>EQBal/EQ1 = %if(%6="e",1,0)
    EQBal/Bal1 = %if(%7="b",1,0)</value>
        </trigger>
        <var name="EQ1" copy="yes">1</var>
        <var name="Bal1" copy="yes">1</var>
      </class>
    </cmud>


    defup alias

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <cmud>
      <alias name="defup" copy="yes">
        <value>alertness on\writhe
    oneb wyvern transform
    oneb wyvern scales
    oneb wyvern aura nature
    oneb touch owl
    oneb deadaim on
    oneb lifesense on
    oneb fitness
    oneb touch cloak
    oneb deathsight
    oneb satiation on
    oneb basilisk summon
    oneb basilisk discern
    oneb eat toadstool\sip mana\vitality
    oneb eat primrose\outr wormwood\outr charcoal\apply camouflage\weathering\resistance\nightsight\mimic @nextCham<;/value>
      </alias>
    </cmud>

    Edit: Forgot instructions. "oneb" is the alias that all the commands work off of. "oneb <command> queues stuff. "oneb list" displays all queued actions. "oneb clear" empties the stack. Last but not least, "oneb push <command>" puts <command> at the top of the stack. The stack won't automatically start if you have balance and eq, so make sure you're not queueing the first command, or queue everything then writhe or diag to get it started. Last note: The %exec in the code means that it will run aliases.
    image
Sign In or Register to comment.