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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Keeping track of potions/pills etc.

Keeping track of potions/pills etc.

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


Posted by Eloge   (20 posts)  [Biography] bio
Date Sun 24 Oct 2010 08:18 AM (UTC)
Message
I have been thinking about creating a window that keeps an up-to-date track on stuff, namely potions,
which I, btw. call internally my 'life insurence'. Yes, they are so important in my play. I want to know - all the
time - how many I am left with at that moment.

Probably a mini-window would be the solution? Then, howto get the appropriate text into that mini-window. I get
from the mud 'You have bought a potion of...' and 'You quaff a potion'. I can also give the command 'look in bag' (where I store my potions. I can have up to 100 potions.

I have created a mini-window and have it placed where i want it to go on my screen. But now???

So, what should I do next. Thanks for any advice?

[Go to top] top

Posted by LezChap   (36 posts)  [Biography] bio
Date Reply #1 on Sun 24 Oct 2010 05:07 PM (UTC)
Message
Have a trigger that detects the number of potions in your bag, and sets that to a potion_count variable:

look in bag
You look in your bag.
You see:
a lantern
some potions[55]
lots of coins [35943]
a pair of dirty socks

Trigger on "some potions\[(\d)+\]" or something like that, regex, and set %1 to the variable.

Trigger on "you quaff a potion" to remove one from potion_count.

Trigger on "you buy..." to add one to potion_count.

I'd do it all in a plug-in. Then it's a matter of every time you change the potion_count variable, redrawing the number in the miniwindow.
[Go to top] top

Posted by Eloge   (20 posts)  [Biography] bio
Date Reply #2 on Sun 24 Oct 2010 06:53 PM (UTC)
Message
LezChap finished the answer to my question where my question starts:

Quote:
Then it's a matter of every time you change the potion_count variable, redrawing the number in the miniwindow.


Yes, of course. Perhaps I am asking too elementary questions. This is however quite clear.

What I am asking, is howto draw the number of potions
(with some text) in the miniwindow.

My question begins where the answer finished. How do you put the contents of a variable (and text) in a mini-window, not how to calculate what to put into the window?
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #3 on Sun 24 Oct 2010 06:58 PM (UTC)
Message
Eloge said:
My question begins where the answer finished. How do you put the contents of a variable (and text) in a mini-window, not how to calculate what to put into the window?

The variable must first be a string or a number (some languages, like Lua, will coerce a number into a string when it's needed as a string). Then you can use WindowText() to draw the text to some point on the screen.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Sun 24 Oct 2010 08:03 PM (UTC)
Message
This video (and small script underneath) show drawing text into a miniwindow:

http://www.gammon.com.au/forum/?id=9626

- Nick Gammon

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

Posted by Eloge   (20 posts)  [Biography] bio
Date Reply #5 on Tue 26 Oct 2010 12:38 AM (UTC)
Message
Thanks!

Now I am on my way, not stuck any more, as I was.

Though I will need a lot of experimenting with the command line (from the video):

WindowText (win, font, "%0", 5, 5, 0, 0, ColourNameToRGB ("yellow"))

Especially the "%0" seems cryptical. How can it be replaced?

Thanks!

[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #6 on Tue 26 Oct 2010 12:45 AM (UTC)

Amended on Tue 26 Oct 2010 12:47 AM (UTC) by Twisol

Message
%0 is a wildcard from a trigger or alias line. In fact, %0 means "all of the matched text", whether there were any wildcards in the pattern or not. If you want to test it outside a trigger or alias, just use whatever text you want to display, instead of %0.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[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.


17,911 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]