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 ➜ Miniwindows ➜ Need super basic MW guidance

Need super basic MW guidance

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


Posted by Navazr   (15 posts)  Bio
Date Thu 07 Nov 2013 01:50 AM (UTC)
Message
Quick and simple:

I need to create a miniwindow to display the contents of a variable. In this case a target variable that will always be a single word name.

Would like it to show something like:

Current Target: <Name>

I've tried reading through all the help here on miniwindows and reading through some of these threads, but I can't seem to grasp even the basics of how to set one of these up. I think once I've got a basic miniwindow script like this in my hands I'll be able to learn how to manipulate it much easier.

Anything to get me going would be greatly appreciated!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 07 Nov 2013 09:14 PM (UTC)

Amended on Tue 26 Nov 2013 01:07 AM (UTC) by Nick Gammon

Message
This video shows how to show the current exits in a miniwindow. Showing a variable would be very similar:




- Nick Gammon

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

Posted by Navazr   (15 posts)  Bio
Date Reply #2 on Fri 08 Nov 2013 07:12 PM (UTC)
Message
Would this work for something that isn't triggered?

I'm currently using an alias to set my target variable, and then that variable is recalled in a bunch of other aliases.

I've got an alias to display the contents of the target variable in the output, but I was hoping to just use a miniwindow to constantly display that variable.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 09 Nov 2013 04:08 AM (UTC)
Message
The miniwindow part shows how to display some sort of short string.

You could, for example, do something similar inside a timer, and have that timer fire every second and find the value of the variable.

- Nick Gammon

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

Posted by Navazr   (15 posts)  Bio
Date Reply #4 on Sat 09 Nov 2013 06:35 PM (UTC)
Message
Alright, seems way above my level of scripting competence!

Guess I'll just continue playing without miniwindows.

Thanks anyway.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Sun 10 Nov 2013 06:31 AM (UTC)

Amended on Sun 10 Nov 2013 06:32 AM (UTC) by Nick Gammon

Message
OK, here's an example:


<timers>
  <timer enabled="y" 
         second="5.00" 
         send_to="12"
         active_closed="y" >
  <send>

var = GetVariable ("foo")

win = GetPluginID ( ) .. ":variable_contents"

font = "f"

WindowCreate ( win, 0, 0, 1, 1, miniwin.pos_top_left, 0, 0)

WindowFont ( win, font, "Courier", 10)

height = WindowFontInfo ( win, font, 1) + 10

width = WindowTextWidth ( win, font, var) + 10

WindowCreate ( win, 0, 0, width, height , miniwin.pos_top_left, 0, ColourNameToRGB ( "green" ))

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

WindowShow ( win )

    </send>
  </timer>
</timers>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


That displays the contents of variable "foo" every 5 seconds on the top left corner.

- Nick Gammon

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

Posted by Navazr   (15 posts)  Bio
Date Reply #6 on Sun 01 Dec 2013 01:11 AM (UTC)

Amended on Sun 01 Dec 2013 01:18 AM (UTC) by Navazr

Message
Alright, I had given up on the MiniWindow thing for quite a while until the other day I decided to give it another go.

Thanks so much for your example here. Using it I've been able to get something very close to what I was looking for.

This is what I've got currently (it's set up as a timer as you suggested):


var = GetVariable ("target")

win = GetPluginID ( ) .. ":variable_contents"

font = "f"

name = "TargetWindow" .. GetPluginID ( )

WindowCreate ( win, 0, 0, 1, 1, miniwin.pos_bottom_center, 0, 0)

WindowFont ( win, font, "Courier", 6, true)

height = WindowFontInfo ( win, font, 1) + 10

width = WindowTextWidth ( win, font, var) + 10

WindowCreate ( win, 0, 0, 250, 25, miniwin.pos_bottom_center, 0, 0x333333)

WindowRectOp( win, miniwin.rect_draw_edge, 2, 2, -2, -2, miniwin.rect_edge_etched, miniwin.rect_edge_at_all)

WindowText ( win, font, "Current Target:", 5, 5, 0, 0, ColourNameToRGB ( "green" ) )

WindowText ( win, font, var, 150, 5, 0, 0, ColourNameToRGB ( "red" ) )

WindowShow ( win )


What I'm trying to do now is figure out how to manually set it's location instead of just using the generic top/bottom left/center/right function. I'm also a bit confused as to why there are two WindowCreates in there.

I've tried just adjusting the top and left values in the WindowCreate function, but it doesn't seem to do anything. And when I cut out the miniwin.pos it just returns an error every time it tries to draw the window.

Here's the window position at bottom_center:

http://s29.postimg.org/e0bp30sit/Mini_Window.jpg

It's offset quite a bit, I'm assuming because of the health bar plugin I've got installed. Though when I set it to Bottom_left it just dumps it right over the health bars.

Any advice?

Thanks in advance!
Top

Posted by Navazr   (15 posts)  Bio
Date Reply #7 on Sun 01 Dec 2013 01:22 AM (UTC)
Message
Nevermind, literally 15 seconds after the previous post I found the miniwin.create_absolute_location in the miniwindow help pages!

Sorry about that!
Top

Posted by Navazr   (15 posts)  Bio
Date Reply #8 on Sun 01 Dec 2013 01:54 AM (UTC)
Message
Alright, another question! =P

Is there a way to create a second window using a timer? I tried setting up a second window on a timer like the previous one, but mush kept alternating between the two windows (the first would disappear when the second was drawn, and the second would disappear when the firsts timer was up and it was redrawn).

I just copied/pasted the previous windows code and put in a different name.

Is there something else I need to do to allow both windows to be drawn at the same time?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #9 on Sun 01 Dec 2013 04:38 AM (UTC)
Message
You would need a different window name (the "win" variable). Also make sure you call the variable itself something else, or you will replace the previous value.

eg.


win2 = "my_other_window"


Then use win2 in place of win in the other timer.

You can have lots of miniwindows.

- Nick Gammon

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

Posted by Navazr   (15 posts)  Bio
Date Reply #10 on Sun 01 Dec 2013 03:27 PM (UTC)
Message
Great!

Sorry for all the questions that probably seem extremely simple to someone like you! I'm just getting my feet wet here though.

I'm sure I'll have more questions as I try to do more complex stuff than just displaying some variable contents, but I'll do my best to scour all the resources here before asking.

Thanks again for all your help!!!
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.


36,237 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.