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


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, 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.
 Entire forum ➜ MUSHclient ➜ VBscript ➜ Windows form element?

Windows form element?

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


Pages: 1  2 

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #15 on Sun 28 Nov 2010 07:48 AM (UTC)
Message
Where do you define win?

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #16 on Sun 28 Nov 2010 07:51 AM (UTC)
Message
I don't exactly know what win is, it was a default from the example code. On a side note, how would I note the return value of writetext?
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #17 on Sun 28 Nov 2010 07:53 AM (UTC)

Amended on Sun 28 Nov 2010 07:54 AM (UTC) by Twisol

Message
'win' is supposed to be a variable you create that contains the name of your window. Since it's undefined, your calls don't do anything, because there's no window to do things to.

[EDIT]: Probably the below, though I don't know how function composition affects parentheses usage in VBscript.
Note WindowText (...)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Ashass   (50 posts)  Bio
Date Reply #18 on Sun 28 Nov 2010 07:56 AM (UTC)
Message
sub createstatus (strAliasName, strOutput, arrWildCards)
  world.WindowCreate "Status", 0, 0, 400, 800, 6, 0, world.ColourNameToRGB("white")
  WindowFont "Status", "f", "Trebuchet MS", 12, TRUE, FALSE, FALSE, FALSE, 0, 0
end sub

sub showstatus (strAliasName, strOutput, arrWildCards)
  WindowShow "Status", true
end sub

sub hidestatus (strAliasName, strOutput, arrWildCards)
  WindowShow "Status", false
end sub

sub writetext (strAliasName, strOutput, arrWildCards)
  WindowText "Status", "f", "Quest Log", 5, 1, 0, 0,ColourNameToRGB ("blue"), false
  WindowShow "Status", true
end sub


This now shows 'Quest Log' in blue font - that was the issue (font not having the window defined)

Preciate the quick help!


Nick, may I suggest, instead of win, maybe change it to "window name" in your samples so it's a little more intuitive?

Ah well! Nice job Twisol!
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #19 on Sun 28 Nov 2010 07:57 AM (UTC)
Message
Glad I could help! :)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #20 on Sun 28 Nov 2010 08:27 PM (UTC)
Message
Ashass said:

Nick, may I suggest, instead of win, maybe change it to "window name" in your samples so it's a little more intuitive?


Glad you got it working.

I hope you are reading the help files, I usually read them myself, and I wrote the stuff:

Template:function=WindowFont WindowFont

The documentation for the WindowFont script function is available online. It is also in the MUSHclient help file.



In there, it makes it clear that the first argument is the window name:


Prototype

long WindowFont(BSTR WindowName, BSTR FontId, BSTR FontName, double Size, BOOL Bold, BOOL Italic, BOOL Underline, BOOL Strikeout, short Charset, short PitchAndFamily);


It also says "WindowName - the name of an existing miniwindow.".

Virtually every miniwindow function needs a window name, this lets you have multiple windows at once. For example "inventory", "chat".

Also it suggests that you append the plugin ID so that the window names are unique between plugins. So for example:


win = "inventory_" & PluginID   ' VBscript
win = "inventory_" .. PluginID () -- Lua


This means the actual window name might be "inventory_21448b31e497a95a36ee5173".

I just used "win" to save typing.

It is useful to use the function-name completion in MUSHclient. Even if you do it in the command window and copy and paste into your script. For example, typing "windowfo" and then hitting Shift+Tab you see offered a menu with WindowFont / WindowFontInfo / WindowFontList.

Choose WindowFont and it gives you the correct spelling and capitalization, and suggests the arguments:


WindowFont ( WindowName , FontId , FontName , Size , Bold , Italic , Underline , Strikeout , Charset , PitchAndFamily )


Now all you have to do is replace words like "WindowName" with, well, the window name.

- Nick Gammon

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

Posted by Ashass   (50 posts)  Bio
Date Reply #21 on Mon 29 Nov 2010 12:56 AM (UTC)
Message
I don't use any third party plugins, should I be writing this as a plugin, instead of just as a vbscript file (that I reference in the scripts section?)

Does it matter one way or the other? -- Should I put the windows into separate boxes, instead of drawing it all out in a single box?

Looking for 'best practices' if you will, since I'm brand new to the mini windows idea.
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #22 on Mon 29 Nov 2010 02:23 AM (UTC)
Message
It's easier ultimately to have a plugin. Plugins handle various callbacks in a more natural way.

Plus you can then just easily add them to multiple world files (eg. if you have multiple characters).

I would use separate windows (boxes) for different things, eg. inventory, stats, etc. - if that is what you meant.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


69,228 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

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

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]