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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  Capturing number of certain vials and sending a world.note
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Capturing number of certain vials and sending a world.note

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


Posted by Natasi   (79 posts)  [Biography] bio
Date Sun 20 Feb 2005 03:30 AM (UTC)

Amended on Sat 26 Feb 2005 09:17 PM (UTC) by Nick Gammon

Message
Ok, trying to set it so when I check my vial list I receive a world.note telling me how many of each vial type I have....for example...I type POTIONLIST and I would see this...



*******************************************************************************
Id       Vial                           Potion                   Sips   Months 
-------------------------------------------------------------------------------
9402     a sapphire vial                a melancholic purgat        9       51
10969    a coral vial                   a sanguine purgative       30       22
11582    a ruby vial                    a potion of allheale       55       81
14275    a ruby vial                    a potion of allheale       60       81
18626    a coral vial                   a sanguine purgative       50       22
20883    a vial                         a potion of frost           5       30
61868    a ruby vial                    a potion of healing        60       56
Type MORE to continue reading. (97% shown)
more
3583h, 2793m, 2779e, 10p ex-
54854    a ruby vial                    a potion of healing        60       61
*******************************************************************************
Total Vials: 8



and I want a world.note that shows something like this, which would also catch vials I'm missing....

Healing 2
Melancholic 1
Sanguine 2
Allheale 2
Frost 1
Quicksilver 0
Mana 0
[Go to top] top

Posted by Natasi   (79 posts)  [Biography] bio
Date Reply #1 on Sun 20 Feb 2005 03:31 AM (UTC)
Message
hmmm, it kinda crunched those together...it' usually spaced out pretty well in the Mud
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #2 on Sun 20 Feb 2005 05:33 AM (UTC)

Amended on Sun 20 Feb 2005 05:34 AM (UTC) by Meerclar

Message
Need a [code] tag if you want to keep proper spacing, the forum is designed to strip whitespace otherwise.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Natasi   (79 posts)  [Biography] bio
Date Reply #3 on Mon 21 Feb 2005 02:35 PM (UTC)
Message
Ok, I rememebr working in OLC and it seemed alot like VBscript. There was a way there to set up a capture that would have a variable it would update everytime another number was added....so when it sees the first vial, it sends a 1 to the variable, when it sees the second vial, it sends another 1, which is added to the 1 already there making it a two...so a counter. you know, I just confused myself...
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #4 on Tue 22 Feb 2005 02:36 PM (UTC)
Message
You'd need two triggers: one for capturing the vial info, and the second one to match on the prompt and disable both itself and the vial trigger. Place them in one group, named "PotionList" for example. Then add an alias to match on "potionlist" or whatever command you want to use for that skill. Have the potionlist alias send the following to script (if you use vbscript):


EnableTriggerGroup "PotionList", 1
Send "config pagelength 250"
Send "potionlist"


Then have the prompt trigger send to script also:


EnableTriggerGroup "PotionList", 0
Send "config pagelength 25"
EndVials


"config pagelength" commands will allow you to avoid the MORE's unless you have more than 250 vials. The following script keeps track of how many vials with each type of potion you have and how many total sips you have of each potion:


dim vails, sips
Set vials = CreateObject("Scripting.Dictionary")
Set sips = CreateObject("Scripting.Dictionary")

sub GotVial(name, output, wildcs)
   dim potion_name, sips_num
   potion_name = wildcs(1)
   sips_num = wildcs(2)
   if vials.Exists(potion_name) then
      vials.Item(potion_name) = vials.Item(potion_name) + 1
   else
      vials.Item(potion_name) = 1
   end if
   if sips.Exists(potion_name) then
      sips.Item(potion_name) = sips.Item(potion_name) + cint(sips_num)
   else
      sips.Item(potion_name) = cint(sips_num)
   end if
end sub

sub EndVials
   ReportVials 
   vials.RemoveAll
   sips.RemoveAll
end sub

sub ReportVials
   dim report
   report = ""
   for each key in vials.Keys
      report = report & key & ": vials=" & vials.Item(key) & ", sips=" & sips.Item(key) & vbCRLF
   next
   Note report 
end sub


The most import part is the trigger that matches on the lines containing the vial info. That trigger should capture exactly 2 wildcards: the first one should contain the potion name, and the second - amount of sips left. The trigger match should be something like:

"^\d+\s+[a-z]+?(melancholic|sanguine|allheale|frost|healing|mana)[a-z]*?\s+(\d{1,3})\s+\d+$"

The first parenthesized group contains all the potion names as they appear on potionlist and that will be used inside the script. I'd put this into a plugin, but as I don't have POTIONLIST yet myself, testing it would be somewhat problematic.
[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.


6,625 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 FutureQuest]