Bit of help needed with a plugin, thanks.

Posted by Jarek on Mon 21 Jul 2003 02:02 AM — 3 posts, 14,030 views.

USA #0
Hey there, working on a script to analyze the stats on an item and report those back in a less cluttered form. It is for the most part done, but
I'm having a few small issues that you might be able to help out with. The script is being done as a plugin with jscript constants.


Problem one -

When loring the item for it's stats I need to take it's wear location and store it to a variable for reporting back later on in the script. I'm unsure
how to store a text variable, is there a world.set style command to do so? The string that this trigger is matching is

"Wear bits:take slot"

with the "slot" changing depending on it's wear slot. Another thing I should mention is that when the item is a light, the string is simply
Wear bits: take, I'm guessing I can simply set the variable to light in the alias that begins the script to get around that. Below is
what I was trying when I realized setvariable only took in numbers.


<trigger
   enabled="y"
   group="sort"
   match="Wear bits: take *"
   send_to="12"
   sequence="51"
>
<send>
  var wearloc;
  world.setvariable (&quot;wearloc&quot;, %1);
</send>
</trigger>  


Problem two -

Trying to set up an alias to autostring the long string of an item based on the stats stored when analyzing the piece. The first problem I
noticed when testing it out was that it did string the item, but instead of replacing @wearlvl or @arm or so on with the appropriate variable,
it just inserted those literally into the string. If there is no way around that I can just make it so that the autostring worldsend is done
by a trigger. I'm also not sure if there will be any problem when the item is called by a command like stringuni 1. or so on by the
player. If I need to do it as a trigger, will storing it as a variable(assuming the answer to above will apply here), will it keep the period?
The aliases I was using are again below.


<alias
   match="stringuni *"
   enabled="y"
   group="sort"
   send_to="12"
   sequence="80"
>  
<send>
    world.send (&quot;autostring %1 long This item is `OUNIQUE``, and has the following properties `OWHEN FIXED``:`RWear Level: `^@wearlvl```RHps: `^@hps``  Mana: `^@man  ``Moves: `^@mov```RAC: `^@arm``  Saves: `^@sav``  Hitroll: `^@hit``  Damroll: `^@dam``&quot;);
</send>
</alias>
<alias
   match="stringnon *"
   enabled="y"
   group="sort"
   send_to="12"
   sequence="80"
>  
<send>
    world.send (&quot;autostring %1 long This item is `#NON-UNIQUE``, and has the following properties:`RWear Level: `^@wearlvl```RHps: `^@hps``  Mana: `^@man``  Moves: `^@mov`R``AC: `^@arm``  Saves: `^@sav``  Hitroll: `^@hit``  Damroll: `^@dam``&quot;);
</send>
</alias>


Thanks much for any help.
Amended on Mon 21 Jul 2003 02:12 AM by Jarek
Australia Forum Administrator #1
Quote:

I'm guessing I can simply set the variable to light in the alias that begins the script to get around that. Below is what I was trying when I realized setvariable only took in numbers.


Variables take strings as their normal contents. If you put numbers in them you need to convert them when you get them out.

The problem is you need to quote the %1, like this:


<triggers>
  <trigger
   enabled="y"
   group="sort"
   match="Wear bits: take *"
   send_to="12"
   sequence="51"
   >
  <send>world.setvariable ("wearloc", "%1");
</send>
  </trigger>
</triggers>



Quote:

... but instead of replacing @wearlvl or @arm or so on with the appropriate variable, it just inserted those literally into the string.


You need to check the "expand variables" box for it to do that.

In other words, inside the alias definition in the plugin, have this line:

expand_variables="y"




Amended on Mon 21 Jul 2003 04:28 AM by Nick Gammon
USA #2
Thanks much for the quick reply. It's all finished up now :)

Thanks again.