Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ need help for an EQ analyzer plugin

need help for an EQ analyzer plugin

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


Posted by Meekah   USA  (16 posts)  Bio
Date Fri 18 Jul 2003 11:10 AM (UTC)

Amended on Fri 18 Jul 2003 01:32 PM (UTC) by Meekah

Message
The mud I play on allows for adding stats to eq, up to a set "max_enchant" level using tokens.
this causes many pieces of eq to have multiple lines of the same stat.
to ease in determining the stats of an item, and what tokens can be applied to, someone created a script to report that. However it was for mudmaster. It has been altered for zmud as well. However, rather than switch clients, I thought I would try my hand at translating it for mushclient. I was already using jscript for the few things I have scripts for, so that is where I started.

The output from the mud from a lore on an item is:

Object 'held item' is type armor, extra flags burn_proof cache bejeweled.
Weight is 0, value is 11000, level is 1 (-14 To Wear).
Wear bits: take hold
Armor class is 500 pierce, 500 bash, 500 slash, and 500 vs. magic.
Affects dexterity by 4.
Affects strength by 3.
Affects wisdom by 3.
Affects constitution by 5.
Affects intelligence by 5.
Affects damage roll by 21.
Affects hit roll by 24.
Affects mana by 200.
Affects hp by 200.
Affects armor class by -493.
Affects damage roll by 21.
Affects hit roll by 24.
Affects mana by 250.
Affects hp by 250.
Affects save vs spell by -40.
Affects armor class by -493.
Affects mana by 300.
Affects hp by 300.

the basic output I would like to see from the plugin is:

CharacterName reports:
This item is NON-UNIQUE, and has the following properties:
Hps: 750 Mana: 750 Moves: 0AC: -986 Saves: -40 Hitroll: 48 Damroll: 42
CharacterName reports:
The following amounts may be applied via tokens:
250/250 work: Hps (0) / Mana (0) / Moves (500)
10/10 work: Hitroll (0) / Damroll (0)
AC work: AC (0)
Spellshield work: Saves (0)
CharacterName reports:
The following amounts of tokens would be used:
250/250: 1
10/10: 0
AC: 0
Spellshield: 0
Style: 1
Fireproof: 0
Gems: 0


so I made all my triggers and aliases, most all of them being send to script, and then used the plugin wizard to make it a plugin.

the first part is semi working, but when it gets to the math functions its not doing what i want.

I am getting this instead:

characternaem reports:
This item is NON-UNIQUE, and has the following properties:
Hps: 750 Mana: 750 Moves: 0AC: 0 Saves: 0 Hitroll: 48 Damroll: 42

charactername reports:
The following amounts may be applied via tokens:
250/250 work: Hps (500) / Mana (500) / Moves (500)
10/10 work: Hitroll (30) / Damroll (30)
AC work: AC (500)
Spellshield work: Saves (25)


charactername reports:
The following amounts of tokens would be used:
250/250: 3
10/10: 3
AC: 2
Spellshield: 1
Style: 1
Fireproof: 1
Gems: 1
the next post(s) contain the plugin as it is now.

If anyone can help I would be grateful.
Top

Posted by Meekah   USA  (16 posts)  Bio
Date Reply #1 on Fri 18 Jul 2003 11:16 AM (UTC)
Message

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, July 18, 2003, 6:28 AM -->
<!-- MuClient version 3.38 -->

<!-- Plugin "analyzer" generated by Plugin Wizard -->

<muclient>
<plugin
   name="analyzer"
   author="Mary Proctor"
   id="fd6aa87a89f1e14d2473e0cf"
   language="JScript"
   purpose="To analyze the stats and tokenwork on a piece of eq"
   save_state="y"
   date_written="2003-07-18 06:25:58"
   requires="3.38"
   version="1.0"
   >

</plugin>


<!--  Get our standard constants -->

<include name="constants.js"/>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   group="sort"
   match="*extra flags *unique*."
   send_to="12"
   sequence="99"
  >
  <send>world.setvariable (&quot;unique&quot;, 1);
world.send (&quot;gt Unique&quot;);</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects hit roll by -*."
   send_to="12"
   sequence="99"
  >
  <send>{
var hitmath;

  hitmath =  parseFloat (world.GetVariable (&quot;hit&quot;));

  if (hitmath == null)
    hitmath = 0;
var uni;
uni = parsefloat (world.getvariable (&quot;unique;&quot;));
if (uni == 0)
hitmath -= %1;
   world.SetVariable (&quot;hit&quot;, hitmath);

}</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   group="sort"
   match="*tells the group 'Unique'"
   send_to="12"
   sequence="101"
  >
  <send>world.send (&quot;emote reports:`RThis item is ``OUNIQUE``, and has the following properties:`RHps: `^@hps``  Mana: `^@man``  Moves: `^@mov``AC: `^@arm``  Saves: `^@sav``  Hitroll: `^@hit``  Damroll: `^@dam``&quot;);

var tenhit;
hit = parsefloat (world.getvariable (&quot;hit&quot;));
tenhit = 30 - hit;
world.setvariable (&quot;tenhit&quot;, 0);
if (tenhit &gt;= 0)
world.setvariable (&quot;tenhit&quot;, tenhit);
var tendam;
dam = parsefloat (world.getvariable (&quot;dam&quot;));
tendam = 30 - dam;
world.setvariable (&quot;tendam&quot;, 0);
if (tendam &gt;= 0)
world.setvariable (&quot;tendam&quot;, tendam);
var twohps;
hps = parsefloat (world.getvariable (&quot;hps&quot;));
twohps = 500 - hps;
world.setvariable (&quot;twohps&quot;, 0);
if (twohps &gt;= 0)
world.setvariable (&quot;twohps&quot;, twohps);
var twoman;
man = parsefloat (world.getvariable (&quot;man&quot;));
twoman = 500 - man;
world.setvariable (&quot;twoman&quot;, 0);
if (twoman &gt;= 0)
world.setvariable (&quot;twoman&quot;, twoman);
var twomov;
mov = parsefloat (world.getvariable (&quot;mov&quot;));
twomov = 500 - mov;
world.setvariable (&quot;twomov&quot;, 0);
if (twomov &gt;= 0)
world.setvariable (&quot;twomov&quot;, twomov);
var newarm;
arm = parsefloat (world.getvariable (&quot;arm&quot;));
newarm = (-500 - arm)* -1;
world.setvariable (&quot;newarm&quot;, 0);
if (twohps &gt;= 0)
world.setvariable (&quot;newarm&quot;, newarm);
var newsav;
sav = parsefloat (world.getvariable (&quot;sav&quot;));
newsav = (-25 - sav)* -1;
world.setvariable (&quot;newsav&quot;, 0);
if (twohps &gt;= 0)
world.setvariable (&quot;newsav&quot;, newsav);
world.send (&quot;emote reports: `RThe following amounts may be applied via tokens:`R`^250/250`` work: Hps (`#@twohps``) / Mana (`#@twoman``) / Moves (`#@twomov``)`R`^10/10`` work: Hitroll (`#@tenhit``) / Damroll (`#@tendam``)`R`^AC`` work: AC (`#@newarm``)`R`^Spellshield`` work: Saves (`#@newsav``)&quot;);
var tenten;
tenten = (tenhit + tendam) / 20;
if (tenten &lt;= 0)
world.setvariable (&quot;tenten&quot;, 0);
if (tenten &gt;= 0)
world.setvariable (&quot;tenten&quot;, 1);
if (tenten &gt;= 1)
world.setvariable (&quot;tenten&quot;, 2);
if (tenten &gt;= 2)
world.setvariable (&quot;tenten&quot;, 3);
if (tenten &gt;= 3)
world.setvariable (&quot;tenten&quot;, 4);
if (tenten &gt;= 4)
world.setvariable (&quot;tenten&quot;, 5);
if (tenten &gt;= 5)
world.setvariable (&quot;tenten&quot;, 6);
var twofifty;
twofifty = (twohps + twoman + twomov) / 500;
if (twofifty &lt;= 0)
world.setvariable (&quot;twofifty&quot;, 0);
if (twofifty &gt;= 0)
world.setvariable (&quot;twofifty&quot;, 1);
if (twofifty &gt;= 1)
world.setvariable (&quot;twofifty&quot;, 2);
if (twofifty &gt;= 2)
world.setvariable (&quot;twofifty&quot;, 3);
if (twofifty &gt;= 3)
world.setvariable (&quot;twofifty&quot;, 4);
if (twofifty &gt;= 4)
world.setvariable (&quot;twofifty&quot;, 5);
if (twofifty &gt;= 5)
world.setvariable (&quot;twofifty&quot;, 6);
if (twofifty &gt;= 6)
world.setvariable (&quot;twofifty&quot;, 7);

var ac;
ac = (newarm) / 250;
if (ac &lt;= 0)
world.setvariable (&quot;ac&quot;, 0);
if (ac &gt;= 0)
world.setvariable (&quot;ac&quot;, 1);
if (ac &gt;= 1)
world.setvariable (&quot;ac&quot;, 2);
if (ac &gt;= 2)
world.setvariable (&quot;ac&quot;, 3);
if (ac &gt;= 3)
world.setvariable (&quot;ac&quot;, 4);
if (ac &gt;= 4)
world.setvariable (&quot;ac&quot;, 5);

var spellshield;
spellshield = (newsav) / 25;
if (spellshield &lt;= 0)
world.setvariable (&quot;spellshield&quot;, 0);
if (spellshield &gt;= 0)
world.setvariable (&quot;spellshield&quot;, 1);
if (spellshield &gt;= 1)
world.setvariable (&quot;spellshield&quot;, 2);
if (spellshield &gt;= 2)
world.setvariable (&quot;spellshield&quot;, 3);
if (spellshield &gt;= 3)
world.setvariable (&quot;spellshield&quot;, 4);

world.send (&quot;emote reports: `RThe following amounts of tokens would be used:`R`^250/250``: `#@twofifty```R`^10/10``: `#@tenten```R`^AC``: `#@ac```R`^Spellshield``: `#@spellshield```R`^Style``: `#@style```R`^Fireproof``: `#@fireproof```R`^Gems``: `#@gem``&quot;)

</send>
  </trigger>
Top

Posted by Meekah   USA  (16 posts)  Bio
Date Reply #2 on Fri 18 Jul 2003 11:17 AM (UTC)
Message
  <trigger
   enabled="y"
   group="sort"
   match="Affects save vs spell by *."
   send_to="12"
   sequence="99"
  >
  <send>{
var savmath;

  savmath =  parseFloat (world.GetVariable (&quot;sav&quot;));

  if (savmath == null)
    savmath = 0;
var uni;
uni = parsefloat (world.getvariable (&quot;unique;&quot;));
if (uni == 0)
savmath -= %1;
   world.SetVariable (&quot;sav&quot;, savmath);

}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects damage roll by *."
   send_to="12"
   sequence="100"
  >
  <send>{
var dammath;
  dammath =  parseFloat (world.GetVariable (&quot;dam&quot;));
  if (dammath == null)
    dammath = 0;
dammath += %1;
   world.SetVariable (&quot;dam&quot;, dammath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects hit roll by *."
   send_to="12"
   sequence="100"
  >
  <send>{
var hitmath;
  hitmath =  parseFloat (world.GetVariable (&quot;hit&quot;));
  if (hitmath == null)
    hitmath = 0;
hitmath += %1;
   world.SetVariable (&quot;hit&quot;, hitmath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects hp by *."
   send_to="12"
   sequence="100"
  >
  <send>{
var hpmath;
  hpmath =  parseFloat (world.GetVariable (&quot;hps&quot;));
  if (hpmath == null)
    hpmath = 0;
hpmath += %1;
   world.SetVariable (&quot;hps&quot;, hpmath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects mana by *."
   send_to="12"
   sequence="100"
  >
  <send>{
var manmath;
  manmath =  parseFloat (world.GetVariable (&quot;man&quot;));
  if (manmath == null)
    manmath = 0;
manmath += %1;
   world.SetVariable (&quot;man&quot;, manmath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects moves by *."
   send_to="12"
   sequence="100"
  >
  <send>{
var movmath;
  movmath =  parseFloat (world.GetVariable (&quot;mov&quot;));
  if (movmath == null)
    movmath = 0;
movmath += %1;
   world.SetVariable (&quot;mov&quot;, movmath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects armor class by -*."
   send_to="12"
   sequence="100"
  >
  <send>{
var armmath;
  armmath =  parseFloat (world.GetVariable (&quot;arm&quot;));
  if (armmath == null)
    armmath = 0;
armmath += %1;
   world.SetVariable (&quot;arm&quot;, armmath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects save vs spell by -*."
   send_to="12"
   sequence="100"
  >
  <send>{
var savmath;
  savmath =  parseFloat (world.GetVariable (&quot;sav&quot;));
  if (savmath == null)
    savmath = 0;
savmath += %1;
   world.SetVariable (&quot;sav&quot;, savmath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects saves by -*."
   send_to="12"
   sequence="100"
  >
  <send>{
var savmath;
  savmath =  parseFloat (world.GetVariable (&quot;sav&quot;));
  if (savmath == null)
    savmath = 0;
savmath += %1;
   world.SetVariable (&quot;sav&quot;, savmath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="*extra flags *gemmed*."
   send_to="12"
   sequence="100"
  >
  <send>world.setvariable (&quot;gemmed&quot;, 1)</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="*tells the group 'Report'"
   send_to="12"
   sequence="100"
  >
  <send>var gemcheck;
gemmcheck = parsefloat (world.getvariable (&quot;gemmed&quot;));
bejcheck = parsefloat (world.getvariable(&quot;bejeweled&quot;));
gemcheck = (gemmcheck + bejcheck)
if (gemcheck == 0)
world.setvariable (&quot;gem&quot;, 2);
if (gemcheck == 1)
world.setvariable (&quot;gem&quot;, 1);
if (gemcheck == 2)
world.setvariable (&quot;gem&quot;, 0);
var firecheck;
firecheck = parsefloat (world.getvariable(&quot;fireproof&quot;));
world.setvariable (&quot;fireproof&quot;, 0);
if (firecheck == 0)
world.setvariable (&quot;fireproof&quot;, 1);
stylecheck = parsefloat (world.getvariable(&quot;style&quot;));
world.setvariable (&quot;style&quot;, 0);
if (stylecheck == 0)
(world.setvariable (&quot;style&quot;, 1));
unicheck = parsefloat (world.getvariable(&quot;unique&quot;));
if (unicheck == 0)
world.send (&quot;gt NonUnique&quot;);
if (unicheck ==1)
world.send (&quot;gt Unique&quot;);

</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects armor class by *."
   send_to="12"
   sequence="99"
  >
  <send>{
var armmath;
  armmath =  parseFloat (world.GetVariable (&quot;arm&quot;));
  if (armmath == null)
    armmath = 0;
var uni;
uni = parsefloat (world.getvariable (&quot;unique;&quot;));
if (uni == 0)
armmath -= %1;
   world.SetVariable (&quot;arm&quot;, armmath);
}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects damage roll by -*."
   send_to="12"
   sequence="99"
  >
  <send>{
var dammath;
  dammath =  parseFloat (world.GetVariable (&quot;dam&quot;));
  if (dammath == null)
    dammath = 0;
var uni;
uni = parsefloat (world.getvariable (&quot;unique;&quot;));
if (uni == 0)
dammath -= %1;
   world.SetVariable (&quot;dam&quot;, dammath);
}</send>
  </trigger>
Top

Posted by Meekah   USA  (16 posts)  Bio
Date Reply #3 on Fri 18 Jul 2003 11:22 AM (UTC)
Message

 <trigger
   enabled="y"
   group="sort"
   match="*extra flags *cache*."
   send_to="12"
   sequence="100"
  >
  <send>world.setvariable (&quot;style&quot;, 1);</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="*extra flags *burn_proof*."
   send_to="12"
   sequence="100"
  >
  <send>world.setvariable (&quot;fireproof&quot;, 1);</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects moves by -*."
   send_to="12"
   sequence="99"
  >
  <send>{
var movmath;

  movmath =  parseFloat (world.GetVariable (&quot;mov&quot;));

  if (movmath == null)
    movmath = 0;
var uni;
uni = parsefloat (world.getvariable (&quot;unique;&quot;));
if (uni &gt;= -1)
movmath -= %1;
   world.SetVariable (&quot;mov&quot;, movmath);

}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects mana by -*."
   send_to="12"
   sequence="99"
  >
  <send>{
var manmath;

  manmath =  parseFloat (world.GetVariable (&quot;man&quot;));

  if (manmath == null)
    manmath = 0;
var uni;
uni = parsefloat (world.getvariable (&quot;unique;&quot;));
if (uni == 0)
manmath -= %1;
   world.SetVariable (&quot;man&quot;, manmath);

}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects hp by -*."
   send_to="12"
   sequence="99"
  >
  <send>{
var hpmath;

  hpmath =  parseFloat (world.GetVariable (&quot;hps&quot;));

  if (hpmath == null)
    hpmath = 0;
var uni;
uni = parsefloat (world.getvariable (&quot;unique;&quot;));
if (uni == 0)
hpmath -= %1;
   world.SetVariable (&quot;hps&quot;, hpmath);

}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="Affects saves by *."
   send_to="12"
   sequence="99"
  >
  <send>{
var savmath;

  savmath =  parseFloat (world.GetVariable (&quot;sav&quot;));

  if (savmath == null)
    savmath = 0;
var uni;
uni = parsefloat (world.getvariable (&quot;unique;&quot;));
if (uni == 0)
savmath -= %1;
   world.SetVariable (&quot;sav&quot;, savmath);

}</send>
  </trigger>
  <trigger
   enabled="y"
   group="sort"
   match="*extra flags *bejeweled*."
   send_to="12"
   sequence="100"
  >
  <send>world.setvariable (&quot;bejeweled&quot;, 1);</send>
  </trigger>
Top

Posted by Meekah   USA  (16 posts)  Bio
Date Reply #4 on Fri 18 Jul 2003 11:23 AM (UTC)
Message

  <trigger
   enabled="y"
   expand_variables="y"
   group="sort"
   match="*tells the group 'NonUnique'"
   send_to="12"
   sequence="101"
  >
  <send>world.send (&quot;emote reports:`RThis item is `#NON-UNIQUE``, and has the following properties:`RHps: `^@hps``  Mana: `^@man``  Moves: `^@mov``AC: `^@arm``  Saves: `^@sav``  Hitroll: `^@hit``  Damroll: `^@dam``&quot;);

var tenhit;
hit = parsefloat (world.getvariable (&quot;hit&quot;));
tenhit = 30 - hit;
world.setvariable (&quot;tenhit&quot;, 0);
if (tenhit &gt;= 0)
world.setvariable (&quot;tenhit&quot;, tenhit);

var tendam;
dam = parsefloat (world.getvariable (&quot;dam&quot;));
tendam = 30 - dam;
world.setvariable (&quot;tendam&quot;, 0);
if (tendam &gt;= 0)
world.setvariable (&quot;tendam&quot;, tendam);

var twohps;
hps = parsefloat (world.getvariable (&quot;hps&quot;));
twohps = 500 - hps;
world.setvariable (&quot;twohps&quot;, 0);
if (twohps &gt;= 0)
world.setvariable (&quot;twohps&quot;, twohps);


var twoman;
man = parsefloat (world.getvariable (&quot;man&quot;));
twoman = 500 - man;
world.setvariable (&quot;twoman&quot;, 0);
if (twoman &gt;= 0)
world.setvariable (&quot;twoman&quot;, twoman);


var twomov;
mov = parsefloat (world.getvariable (&quot;mov&quot;));
twomov = 500 - mov;
world.setvariable (&quot;twomov&quot;, 0);
if (twomov &gt;= 0)
world.setvariable (&quot;twomov&quot;, twomov);


var newarm;
arm = parsefloat (world.getvariable (&quot;arm&quot;));
newarm = (-500 - arm)* -1;
world.setvariable (&quot;newarm&quot;, 0);
if (twohps &gt;= 0)
world.setvariable (&quot;newarm&quot;, newarm);

var newsav;
sav = parsefloat (world.getvariable (&quot;sav&quot;));
newsav = (-25 - sav)* -1;
world.setvariable (&quot;newsav&quot;, 0);
if (twohps &gt;= 0)
world.setvariable (&quot;newsav&quot;, newsav);

world.send (&quot;emote reports: `RThe following amounts may be applied via tokens:`R`^250/250`` work: Hps (`#@twohps``) / Mana (`#@twoman``) / Moves (`#@twomov``)`R`^10/10`` work: Hitroll (`#@tenhit``) / Damroll (`#@tendam``)`R`^AC`` work: AC (`#@newarm``)`R`^Spellshield`` work: Saves (`#@newsav``)&quot;);

var tenten;
tenten = (tenhit + tendam) / 20;
if (tenten &lt;= 0)
world.setvariable (&quot;tenten&quot;, 0);
if (tenten &gt;= 0)
world.setvariable (&quot;tenten&quot;, 1);
if (tenten &gt;= 1)
world.setvariable (&quot;tenten&quot;, 2);
if (tenten &gt;= 2)
world.setvariable (&quot;tenten&quot;, 3);
if (tenten &gt;= 3)
world.setvariable (&quot;tenten&quot;, 4);
if (tenten &gt;= 4)
world.setvariable (&quot;tenten&quot;, 5);
if (tenten &gt;= 5)
world.setvariable (&quot;tenten&quot;, 6);

var twofifty;
twofifty = (twohps + twoman + twomov) / 500;
if (twofifty &lt;= 0)
world.setvariable (&quot;twofifty&quot;, 0);
if (twofifty &gt;= 0)
world.setvariable (&quot;twofifty&quot;, 1);
if (twofifty &gt;= 1)
world.setvariable (&quot;twofifty&quot;, 2);
if (twofifty &gt;= 2)
world.setvariable (&quot;twofifty&quot;, 3);
if (twofifty &gt;= 3)
world.setvariable (&quot;twofifty&quot;, 4);
if (twofifty &gt;= 4)
world.setvariable (&quot;twofifty&quot;, 5);
if (twofifty &gt;= 5)
world.setvariable (&quot;twofifty&quot;, 6);
if (twofifty &gt;= 6)
world.setvariable (&quot;twofifty&quot;, 7);

var ac;
ac = (newarm) / 250;
if (ac &lt;= 0)
world.setvariable (&quot;ac&quot;, 0);
if (ac &gt;= 0)
world.setvariable (&quot;ac&quot;, 1);
if (ac &gt;= 1)
world.setvariable (&quot;ac&quot;, 2);
if (ac &gt;= 2)
world.setvariable (&quot;ac&quot;, 3);
if (ac &gt;= 3)
world.setvariable (&quot;ac&quot;, 4);
if (ac &gt;= 4)
world.setvariable (&quot;ac&quot;, 5);

var spellshield;
spellshield = (newsav) / 25;
if (spellshield &lt;= 0)
world.setvariable (&quot;spellshield&quot;, 0);
if (spellshield &gt;= 0)
world.setvariable (&quot;spellshield&quot;, 1);
if (spellshield &gt;= 1)
world.setvariable (&quot;spellshield&quot;, 2);
if (spellshield &gt;= 2)
world.setvariable (&quot;spellshield&quot;, 3);
if (spellshield &gt;= 3)
world.setvariable (&quot;spellshield&quot;, 4);

world.send (&quot;emote reports: `RThe following amounts of tokens would be used:`R`^250/250``: `#@twofifty```R`^10/10``: `#@tenten```R`^AC``: `#@ac```R`^Spellshield``: `#@spellshield```R`^Style``: `#@style```R`^Fireproof``: `#@fireproof```R`^Gems``: `#@gem``&quot;)

</send>
  </trigger>
</triggers>
Top

Posted by Meekah   USA  (16 posts)  Bio
Date Reply #5 on Fri 18 Jul 2003 11:24 AM (UTC)
Message

<!--  Aliases  -->

<aliases>
  <alias
   match="analyze *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>world.enabletriggergroup (&quot;sort&quot;, 1);
world.setvariable (&quot;ac&quot;, 2);
world.setvariable (&quot;acmod&quot;, 0);
world.setvariable (&quot;arm&quot;, 0);
world.setvariable (&quot;con&quot;, 0);
world.setvariable (&quot;dam&quot;, 0);
world.setvariable (&quot;dex&quot;, 0);
world.setvariable (&quot;fireproof&quot;, 1);
world.setvariable (&quot;hit&quot;, 0);
world.setvariable (&quot;hps&quot;, 0);
world.setvariable (&quot;int&quot;, 0);
world.setvariable (&quot;man&quot;, 0);
world.setvariable (&quot;mov&quot;, 0);
world.setvariable (&quot;newarm&quot;, 500);
world.setvariable (&quot;newsav&quot;, 25);
world.setvariable (&quot;psi&quot;, 0);
world.setvariable (&quot;sav&quot;, 0);
world.setvariable (&quot;spellmod&quot;, 0);
world.setvariable (&quot;spellshield&quot;, 1);
world.setvariable (&quot;str&quot;, 0);
world.setvariable (&quot;style&quot;, 1);
world.setvariable (&quot;tendam&quot;, 30);
world.setvariable (&quot;tenhit&quot;, 30);
world.setvariable (&quot;tenmod&quot;, 0);
world.setvariable (&quot;tenten&quot;, 3);
world.setvariable (&quot;twofifty&quot;, 3);
world.setvariable (&quot;twohps&quot;, 500);
world.setvariable (&quot;twoman&quot;, 500);
world.setvariable (&quot;twomod&quot;, 0);
world.setvariable (&quot;twomov&quot;, 500);
world.setvariable (&quot;unique&quot;, 0);
world.setvariable (&quot;wis&quot;, 0);
world.setvariable (&quot;bejeweled&quot;, 0);
world.setvariable (&quot;fireproof&quot;, 0);
world.setvariable (&quot;style&quot;, 0);
world.setvariable (&quot;gemmed&quot;, 0);
world.setvariable (&quot;unique&quot;, 0);
world.send (&quot;lore %1&quot;);
world.send (&quot;gt Report&quot;);
</send>
  </alias>
  <alias
   match="sortoff"
   enabled="y"
   group="sort"
   send_to="12"
   sequence="100"
  >
  <send>
world.enabletriggergroup (&quot;sort&quot;, 0);</send>
  </alias>
</aliases>

<!--  Variables  -->

<variables>
  <variable name="spellshield">1</variable>
  <variable name="hit">0</variable>
  <variable name="psi">0</variable>
  <variable name="tenten">3</variable>
  <variable name="tenhit">30</variable>
  <variable name="ac">2</variable>
  <variable name="twoman">500</variable>
  <variable name="style">0</variable>
  <variable name="man">0</variable>
  <variable name="twohps">500</variable>
  <variable name="hps">0</variable>
  <variable name="newarm">500</variable>
  <variable name="int">0</variable>
  <variable name="fireproof">0</variable>
  <variable name="dam">0</variable>
  <variable name="newsav">25</variable>
  <variable name="gemmed">0</variable>
  <variable name="str">0</variable>
  <variable name="wis">0</variable>
  <variable name="twofifty">3</variable>
  <variable name="tendam">30</variable>
  <variable name="dex">0</variable>
  <variable name="acmod">0</variable>
  <variable name="twomod">0</variable>
  <variable name="twomov">500</variable>
  <variable name="arm">0</variable>
  <variable name="bejeweled">0</variable>
  <variable name="unique">0</variable>
  <variable name="mov">0</variable>
  <variable name="con">0</variable>
  <variable name="sav">0</variable>
  <variable name="tenmod">0</variable>
  <variable name="spellmod">0</variable>
</variables>

</muclient>



admittedly I have probably gone about this the long way
so any and all suggestions are more then welcome
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #6 on Fri 18 Jul 2003 09:32 PM (UTC)

Amended on Fri 18 Jul 2003 09:33 PM (UTC) by Nick Gammon

Message

  1. For a start, I think it is unnecessarily lengthy, which adds to the confusion. How about a single trigger for each affect, rather than on each? At least if there is a problem you only have to fix it once.

    Here is my example trigger:

    
    <triggers>
      <trigger
       enabled="y"
       group="sort"
       match="Affects * by *."
       send_to="12"
       sequence="99"
      >
      <send>{
    var v;  // variable contents
    
     v = parseFloat (world.GetVariable (&quot;%1&quot;));
    
     if (v == null)
        v = 0;
    
     if (parseFloat (world.getvariable (&quot;unique&quot;)) == 0)
       world.SetVariable (&quot;%1&quot;, v + %2);
    
    }</send>
      </trigger>
    </triggers>
    


    Since this matches on "Affects * by *." it should catch all the affects, and set the appropriate variable (eg. if it matches "Affects hp by 200." then it will add 200 to the variable "hp".

  2. You seem to have two sets of triggers - one to subtract and one to add. A general trigger (like the one above) should handle both cases, after all, adding -5 is the same as subtracting 5.

  3. Your testing for unique items has an extra semicolon - this gets the variable "unique;" whereas you are setting variable "unique". Thus it will never match.

    eg.


    uni = parsefloat (world.getvariable (&quot;unique;&quot;));


  4. Your matching for "*unique*" (and other things like "*gemmed*") won't work because the asterisk is a wildcard, and I presume the asterisk actually appears in the output? You need a regular expression to match on asterisks.

    eg.

    Instead of matching on:


    match="*extra flags *unique*."


    Use:


    match=".*extra flags \*unique\*\."
    regexp="y"


    The backslashes "escape" out the asterisk so it matches literally.


  5. I'm not sure what this is trying to do ...

    
    var ac;
    ac = (newarm) / 250;
    if (ac <= 0)
      world.setvariable ("ac", 0);
    if (ac >= 0)
      world.setvariable ("ac", 1);
    if (ac >= 1)
      world.setvariable ("ac", 2);
    if (ac >= 2)
      world.setvariable ("ac", 3);
    if (ac >= 3)
      world.setvariable ("ac", 4);
    if (ac >= 4)
      world.setvariable ("ac", 5);
    


    But, isn't there an easier way?

    eg.

    
    var ac;
    
    // do calculation, round result to nearest integer
    ac = Math.round (newarm / 250);
    
    if (ac <= 0)
      ac = 0;  // too small
    else if (ac >= 4)
      ac = 5;  // too large
    
    world.setvariable ("ac", ac);
    



I suggest making those changes and see if you still have a problem. :)


- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


23,700 views.

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

Go to topic:           Search the forum


[Go to top] top

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