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 ➜ Bit of help needed with a plugin, thanks.

Bit of help needed with a plugin, thanks.

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


Posted by Jarek   USA  (2 posts)  Bio
Date Mon 21 Jul 2003 02:02 AM (UTC)

Amended on Mon 21 Jul 2003 02:12 AM (UTC) by Jarek

Message
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.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 21 Jul 2003 04:21 AM (UTC)

Amended on Mon 21 Jul 2003 04:28 AM (UTC) by Nick Gammon

Message
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"





- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Jarek   USA  (2 posts)  Bio
Date Reply #2 on Mon 21 Jul 2003 08:01 AM (UTC)
Message
Thanks much for the quick reply. It's all finished up now :)

Thanks again.
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.


13,358 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.