[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]  VBscript
. . -> [Subject]  Windows form element?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Windows form element?

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2 

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

'Soludra' on Achaea

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

Posted by Ashass   (50 posts)  [Biography] bio
Date Reply #16 on Sun 28 Nov 2010 07:51 AM (UTC)  quote  ]
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?
[Go to top] top

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

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
[Go to top] top

Posted by Ashass   (50 posts)  [Biography] bio
Date Reply #18 on Sun 28 Nov 2010 07:56 AM (UTC)  quote  ]
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!
[Go to top] top

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

'Soludra' on Achaea

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

Posted by Nick Gammon   Australia  (19,666 posts)  [Biography] bio   Forum Administrator
Date Reply #20 on Sun 28 Nov 2010 08:27 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Ashass   (50 posts)  [Biography] bio
Date Reply #21 on Mon 29 Nov 2010 12:56 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (19,666 posts)  [Biography] bio   Forum Administrator
Date Reply #22 on Mon 29 Nov 2010 02:23 AM (UTC)  quote  ]
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
[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.


10,499 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.   [New subject]  Start a new subject   [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.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]