[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Jscript
. . -> [Subject]  problem with chat plugin

problem with chat plugin

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Sno99   (8 posts)  [Biography] bio
Date Sun 05 Oct 2003 01:35 PM (UTC)
Message
is it possible to convert mm script to jscript for mushc, or would it be better to just write new script?
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #1 on Mon 06 Oct 2003 02:36 PM (UTC)
Message
Hmm, What is "mm"? Is that "MudMaster"?

I don't believe there are any tools commonly available for converting script as you request. It would need to be done by hand.

MUSHclient, with its plugin concept, is very flexable about handling self-contained aliases, triggers, timers and scripts.

Post whatever mm stuff you have, and perhaps someone here will help you translate it. I'm not a "jscript" person, VBS is more my thing, but there are several others here who may help.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 08 Oct 2003 04:45 AM (UTC)
Message
I think every MUD client that supports scripting does it differently. At least MUSHclient uses standard script engines, however the interface between the engine and the client (ie. world.xxx routines) are still custom to MUSHclient.

I suggest you simply rewrite. If, as Magnum suggested, you post an example we could show how it might be converted.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Sno99   (8 posts)  [Biography] bio
Date Reply #3 on Wed 08 Oct 2003 02:09 PM (UTC)
Message
/action {Upkeep: %1} {/var {ObjKeep} {$1}} {ItemID}
/action {Location: %0} {/var ItemEquip $0} {ItemID}
/action {Weapon Proficiency type is %1 weapons} {/var {WpnProf} {$1}} {ItemID}
/action {^ %0 to %1} {/if {$ItemAffectCount=0} {/var {ItemAffectCount} {1};/var {ItemAffectOneNum} {$0};/var {ItemAffectOneStat} {$1}} {/if {$ItemAffectCount=1} {/var {ItemAffectCount} {2};/var {ItemAffectTwoNum} {$0};/var {ItemAffectTwoStat} {$1}} {/if {$ItemAffectCount=2} {/var {ItemAffectThreeNum} {$0};/var {ItemAffectThreeStat} {$1}}}}} {ItemID}
/action {^AC-apply is %0 Armor type is %1} {/var ItemAC $0;/var ItemACType $1} {ItemID}
/action {^Attributes: %0} {/var ItemAttr $0} {ItemID}
/action {^Damage Dice is %0} {/var ItemDice $0} {ItemID}
/action {^Item type: %0 Effects: %1} {/var ItemType $0;/var {TempEffects} {$1}} {ItemID}
/action {^Object: %0 [%1]} {/var ObjectName $0;/var Object $1} {ItemID}
/action {^Weight: %0 Value: %1 Level Restriction: %2} {/var ItemWeight $0;/var ItemValue $1;/var ItemLevel $2} {ItemID}
/action {^Your divination is complete} {/var ItemAffectCount 0;/empty ItemAffectOneStat;/empty ItemAffectOneNum;/empty ItemAffectTwoStat;/empty ItemAffectTwoNum;/empty ItemAffectThreeNum;/Empty ItemAffectThreeStat;/empty ItemAttr;/empty ItemDice;/empty ItemSpell;/empty ItemAC;/empty ItemCond;/empty TempEffects;/empty ItemEffects;/empty ObjName;/empty WpnProf} {ItemID}
/action {This item appears to be in perfect pristine condition.} {/var {ItemCond} {pristine}} {ITem ID}
/alias {chid} {/var {BriefID} {@AnsiBold()@ForeWhite()@ForeRed() Loc@ForeBlue()(@ForeWhite()@RTrim(@Lower($ItemEquip))@ForeBlue())};/var {BriefID} {@ConCat($BriefID, @ForeRed()Lev@ForeBlue()(@ForeWhite()$ItemLevel@ForeBlue()))};/var {BriefID} {@ConCat($BriefID, @ForeRed()Type@ForeBlue()(@ForeWhite()$ItemType@ForeBlue()))};/if {@IsEmpty($ItemAC)=0} {/var BriefID @ConCat($BriefID, @ForeRed()Ac@ForeBlue()[@ForeWhite()$ItemACType@ForeBlue()(@ForeWhite()$ItemAC@ForeBlue()))]};/if {@IsEmpty($ItemDice)=0} {/var BriefID @ConCat($BriefID, @ForeRed()Dice@ForeBlue()[@ForeWhite()$ItemDice@ForeBlue()(@ForeRed()@ForeWhite()$WpnProf@ForeBlue())])};lookupeff;/if {@IsEmpty($ItemAffectOneStat)=0} {/var BriefID @ConCat($BriefID,@Chr(10)@ForeRed() @Lower($ItemAffectOneStat)@ForeBlue()(@ForeWhite()$ItemAffectOneNum@ForeBlue()))} {};/if {@IsEmpty($ItemAffectTwoStat)=0} {/var {BriefID} {@ConCat($BriefID, @ForeRed()@Lower($ItemAffectTwoStat)@ForeBlue()(@ForeWhite()$ItemAffectTwoNum@ForeBlue()))}};/if {@IsEmpty($ItemAffectThreeStat)=0} {/var {BriefID} {@ConCat($BriefID, @ForeRed()@Lower($ItemAffectThreeStat)@ForeBlue()(@ForeWhite()$ItemAffectThreeNum@ForeBlue()))}};/if {@IsEmpty($ItemCond)=0} {/var {BriefID} {@ConCat($BriefID,@ForeRed()@Chr(10) Cond@ForeBlue()(@ForeWhite()$ItemCond@ForeBlue()))};/var {BriefID} {@ConCat($BriefID,@ForeRed() Effects@ForeBlue()[@ForeWhite()@RTrim($ItemEffects)@ForeBlue()])}};/emotea @AnsiBold()@ForeRed()has looked at @ForeWhite()$ObjectName @ForeRed()and seen...@Chr(10)$BriefID} {ItemID}
/alias {id %1} {/var {chan} {$1} {};/var BriefID {$ObjectName:};/var BriefID @ConCat($BriefID, Lev($ItemLevel));/var BriefID @ConCat($BriefID, Loc(@Lower(@RTrim($ItemEquip))));/if {@IsEmpty($ItemAC)=0} {/var BriefID @ConCat($BriefID, Ac($ItemAC))};/if {@IsEmpty($ItemDice)=0} {/var BriefID @ConCat($BriefID, $ItemDice)};lookupeff;/if {@IsEmpty($ItemAffectOneStat)=0} {/var BriefID @ConCat($BriefID, @Lower($ItemAffectOneStat)($ItemAffectOneNum))};/if {@IsEmpty($ItemAffectTwoStat)=0} {/var BriefID @ConCat($BriefID, @Lower($ItemAffectTwoStat)($ItemAffectTwoNum))};/if {@IsEmpty($ItemAffectThreeStat)=0} {/var {BriefID} {@ConCat($BriefID, @Lower($ItemAffectThreeStat)($ItemAffectThreeNum))}};/var {BriefID} {@ConCat($BriefID, [$ItemEffects])};$chan $BriefID} {ItemID}
/alias {lookupeff} {/empty {ItemEffects};/var {wcount} {1};/loop {1,@WordCount($TempEffects)} {/var {lcount} {$LoopCount};/loop {1,27} {/var {lcount2} {$LoopCount};/if {"@Word($TempEffects,$wcount)" = "@GetArray(Effects,$lcount2,1)"} {/math {wcount} {$wcount+1};/var {ItemEffects} {@ConCat(@ConCat($ItemEffects,@GetArray(Effects,$lcount2,2)), )}}}}} {ItemID}
/array {Effects} {27,2} {ItemID}
/assign {Effects} {1,1} {Glow}
/assign {Effects} {1,2} {Glw}
/assign {Effects} {2,1} {Hum}
/assign {Effects} {2,2} {Hum}
/assign {Effects} {3,1} {!Rent}
/assign {Effects} {3,2} {!Rnt}
/assign {Effects} {4,1} {!Donate}
/assign {Effects} {4,2} {!Don}
/assign {Effects} {5,1} {Invis}
/assign {Effects} {5,2} {Inv}
/assign {Effects} {6,1} {Magic}
/assign {Effects} {6,2} {Mgc}
/assign {Effects} {7,1} {!Drop}
/assign {Effects} {7,2} {!Drp}
/assign {Effects} {8,1} {!Good}
/assign {Effects} {8,2} {!G}
/assign {Effects} {9,1} {!Evil}
/assign {Effects} {9,2} {!E}
/assign {Effects} {10,1} {!Neutral}
/assign {Effects} {10,2} {!N}
/assign {Effects} {11,1} {!Sorcerer}
/assign {Effects} {11,2} {!S}
/assign {Effects} {12,1} {!Monk}
/assign {Effects} {12,2} {!M}
/assign {Effects} {13,1} {!Rogue}
/assign {Effects} {13,2} {!R}
/assign {Effects} {14,1} {UniqueSave}
/assign {Effects} {14,2} {US}
/assign {Effects} {15,1} {!Sell}
/assign {Effects} {16,1} {Slippery}
/assign {Effects} {16,2} {Slip}
/assign {Effects} {17,1} {SmiteGood}
/assign {Effects} {17,2} {SG}
/assign {Effects} {18,1} {SmiteEvil}
/assign {Effects} {18,2} {SE}
/assign {Effects} {19,1} {Dagger}
/assign {Effects} {19,2} {Dag}
/assign {Effects} {20,1} {TwoHanded}
/assign {Effects} {20,2} {2H}
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #4 on Wed 08 Oct 2003 11:07 PM (UTC)

Amended on Wed 08 Oct 2003 11:08 PM (UTC) by Shadowfyr

Message
Ack..! What the heck is that, an esoteric language? lol I really don't get why people that code clients like mm seem to thing making the languages so that you can cram 50 lines of code on one line and make it completely unreadable is a 'good' thing. :(

Hmm.. This would require not merely a script, but a full plugin. For instance /action is a trigger, which you 'could' generate in JScript, but is better off done in a plugin, unless you are continually creating and deleting them.

Hmm.

<triggers
  <trigger
    match="Upkeep: *"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>setvariable ("ObjKeep","%1");</send>
  </trigger>

  <trigger
    match="Location: *"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>setvariable ("ItemEquip","%1");</send>
  </trigger>

  <trigger
    match="Weapon Proficiency type is * weapons"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>setvariable ("WpnProf","%1");</send>
  </trigger>

  <trigger
    match="^ .* to .*"
    regexp="y"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      if (getvariable("ItemAffectCount == 0)
        {setvariable ("ItemAffectCount",1);
         setvariable ("ItemAffectOneNum","%1");
         setvariable ("ItemAffectOneStat","%2");}
      if (getvariable("ItemAffectCount == 1)
        {setvariable ("ItemAffectCount",2);
         setvariable ("ItemAffectTwoNum","%1");
         setvariable ("ItemAffectTwoStat","%2");}
      if (getvariable("ItemAffectCount == 2)
        {setvariable ("ItemAffectCount",3);
         setvariable ("ItemAffectThreeNum","%1");
         setvariable ("ItemAffectThreeStat","%2");}
    </send>
  </trigger>

  <trigger
    match="^AC-apply is .* Armor type is .*"
    regexp="y"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      setvariable ("ItemAC","%1");
      setvariable ("ItemACType","%2")
    </send>
  </trigger>

  <trigger
    match="^Attributes: .*"
    regexp="y"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      setvariable ("ItemAttr","%1")
    </send>
  </trigger>

  <trigger
    match="^Damage Dice is .*"
    regexp="y"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      setvariable ("ItemDice","%1")
    </send>
  </trigger>

  <trigger
    match="^Item type: .* Effects: .*"
    regexp="y"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      setvariable ("ItemType","%1");
      setvariable ("TempEffects","%2")
    </send>
  </trigger>

  <trigger
    match="^Object: .* [.*]"
    regexp="y"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      setvariable ("ObjectName","%1");
      setvariable ("Object","%2")
    </send>
  </trigger>

  <trigger
    match="^Weight: .* Value: .* Level Restriction: .*"
    regexp="y"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      setvariable ("ItemWeight","%1");
      setvariable ("ItemValue","%2");
      setvariable ("ItemLevel","%3")
    </send>
  </trigger>

  <trigger
    match="^Your divination is complete"
    regexp="y"
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      var temp;
      var temp2;
      var temp3;
      var chan;
      chan = getvariable("chan");
      if (chan || "")
        {temp = getvariable("ItemEquip");
          temp2 = temp2.concat(ANSI(1), ANSI(31), " Loc", ANSI(34), "(", ANSI(37), temp.toLowerCase(), ANSI(34));
          temp = getvariable("ItemLevel");
          temp2 = temp2.concat(" ", ANSI(31), "Lev", ANSI(34), "(", ANSI(37), temp, ANSI(34),")");
          temp = getvariable("ItemType");
          temp2 = temp2.concat(" ", ANSI(31), "Type", ANSI(34), "(", ANSI(37), temp, ANSI(34),")");
          temp = getvariable("ItemAc");
          if (temp || "")
            {temp2 = temp2.concat(" ", ANSI(31), "Ac", ANSI(34), "[", ANSI(37), temp, ANSI(34), "]")
          };
          temp = getvariable("ItemDice");
          if (ItemDice || "")
            {temp2 = temp2.concat(" ", ANSI(31), "Dice", ANSI(34), "[", ANSI(37), temp, ANSI(34), "]")
          };
          lookupeff;
          ansinote temp2
          temp2 = ""
          temp = getvariable("ItemAffectOneStat");
          temp3 = getvariable("ItemAffectOneNum");
          if (temp || "")
            {temp2 = temp2.concat(ANSI(1), ANSI(31), temp.toLowerCase(), ANSI(34), "(", ANSI(37), temp3, ANSI(34),")")
          };
          temp = getvariable("ItemAffectTwoStat");
          temp3 = getvariable("ItemAffectTwoNum");
          if (temp || "")
            {temp2 = temp2.concat(ANSI(31), temp.toLowerCase(), ANSI(34), "(", ANSI(37), temp3, ANSI(34),")")
          };
          temp = getvariable("ItemAffectThreeStat");
          temp3 = getvariable("ItemAffectThreeNum");
          if (temp || "")
            {temp2 = temp2.concat(ANSI(31), temp.toLowerCase(), ANSI(34), "(", ANSI(37), temp3, ANSI(34),")")
          };
          ansinote temp2
          temp2 = ""
          temp = getvariable("ItemCond");
          if (temp || "")
            {temp2 = temp2.concat(ANSI(1), ANSI(31), temp, ANSI(34), "(", ANSI(37), temp3, ANSI(34),")")
          };
          temp2 = temp2.concat(ANSI(31), " Effects", ANSI(34)"[", ANSI(37), temp, ANSI(34), "]")
          ansinote temp2
        }
      else
        {setvariable("chan","%1")
          temp = getvariable("ObjectName");
          temp2 = temp2.concat(temp, ":");
          temp = getvariable("ItemLevel");
          temp2 = temp2.concat(" Lev(", temp, ")");
          temp = getvariable("ItemEquip");
          temp2 = temp2.concat(" Loc(", temp.toLowerCase(), ")");
          temp = getvariable("ItemAC");
          if (temp || "")
            {temp2 = temp2.concat(" Ac(", temp, ")")
          }; 
          temp = getvariable("ItemDice");
          if (temp || "")
            {temp2 = temp2.concat(" ", temp)
          };
          lookupeff;
          temp = getvariable("ItemAffectOneStat");
          temp3 = getvariable("ItemAffectOneNum");
          if (temp || "")
            {temp2 = temp2.concat(" ", temp.toLowerCase(), "(", temp3, ")")
          };
          temp = getvariable("ItemAffectTwoStat");
          temp3 = getvariable("ItemAffectTwoNum");
          if (temp || "")
            {temp2 = temp2.concat(" ", temp.toLowerCase(), "(", temp3, ")")
          }; 
          temp = getvariable("ItemAffectThreeStat");
          temp3 = getvariable("ItemAffectThreeNum");
          if (temp || "")
            {temp2 = temp2.concat(" ", temp.toLowerCase(), "(", temp3, ")")
          };
          temp = getvariable("ItemEffects");
          temp2 = temp2.concat(" [", temp, "]"
          send(chan.concat(" ", temp2));
      };
      setvariable ("ItemAffectCount",0);
      setvariable ("ItemAffectOneStat","");
      setvariable ("ItemAffectOneNum","");
      setvariable ("ItemAffectTwoStat","");
      setvariable ("ItemAffectTwoNum","");
      setvariable ("ItemAffectThreeStat","");
      setvariable ("ItemAffectThreeNum","");
      setvariable ("ItemAttr","");
      setvariable ("ItemDice","");
      setvariable ("ItemSpell","");
      setvariable ("ItemAC","");
      setvariable ("ItemCond","");
      setvariable ("TempEffects","");
      setvariable ("ItemEffects","");
      setvariable ("ObjName","");
      setvariable ("WpnProf","")
    </send>
  </trigger>

  <trigger
    match="This item appears to be in perfect pristine condition."
    enabled="y"
    group="ItemID"
    send_to="12">
    <send>
      setvariable ("ItemCond","pristine");
      setvariable ("Object","%2")
    </send>
  </trigger>
</triggers>

<aliases>
  <alias
    match="chid"
    enabled="y"
    send_to="12"
  >
  <send>
    setvariable("chan","")
  </alias>

  <alias
    match="id *"
    enabled="y"
    send_to="12"
  >
  <send>
  </send>
</aliases>

<script>
  function lookupeff()
    {
      I have no clue how to make a multidimansional array in Jscript, so...
      ??????
    }
</script>



This should give someone else a good starting point at least. :p The last bit in the lookupeff part looks fairly straight forward, once you figure out how to create the array.

NOTE: The code to send to a channel or display had to be moved into the trigger for completing the divination. Apparently MM's scripts run parallel or something, but in Mushclient the display code would never produce results, because the alias would execute, try to do stuff, and 'then' the triggers would all fire.

This brings up another issue. Do MM aliases not just execute MM script, or do they pass the alias itself on to the mud to execute? I don't see how this works, since no commands are executed by the aliases to begin a divination. Maybe I just missed something, but in the above form it wouldn't do anything, since no divination would ever be started by either alias.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,304 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]