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

Gammon Software Solutions 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?
(New message)
Subject: Windows form element?
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date 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

Posted by Ashass   (50 posts)  [Biography] bio
Date 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  (18,797 posts)  [Biography] bio   Forum Administrator
Date 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 Twisol   USA  (2,230 posts)  [Biography] bio
Date 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 Ashass   (50 posts)  [Biography] bio
Date 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,230 posts)  [Biography] bio
Date 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 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,230 posts)  [Biography] bio
Date 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 Sun 28 Nov 2010 07:48 AM (UTC)  quote  ]
Message
Status is the window, 'f' is the font.

world.WindowCreate "Status", 0, 0, 400, 800, 6, 0, world.ColourNameToRGB("white")
  WindowFont win, "f", "Trebuchet MS", 12, TRUE, FALSE, FALSE, FALSE, 0, 0


So how does that translate into windowtext?
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Sun 28 Nov 2010 07:48 AM (UTC)  quote  ]
Message
I know it's already shown, the point was to refresh the view. Which apparently didn't work.

Try Note'ing the return value from WindowText (and WindowFont). If anything's not 0, go to the errors list [1] and find what it means.

[1] http://www.gammon.com.au/scripts/function.php?action=errors

'Soludra' on Achaea

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

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Sun 28 Nov 2010 07:46 AM (UTC)  quote  ]
Message

WindowFont win, "Status", "Trebuchet MS", 12, TRUE, FALSE, FALSE, FALSE, 0, 0


Is "Status" the font or the window? You really need a font name (eg. "f") and a window name.

- Nick Gammon

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

Posted by Ashass   (50 posts)  [Biography] bio
Date Sun 28 Nov 2010 07:34 AM (UTC)  quote  ]
Message
Yeah... that did nothing =P

The window is already shown, so i have a white palette, but no text appears on that palette.
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Sun 28 Nov 2010 07:32 AM (UTC)  quote  ]

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

Message
Add a WindowShow win, true call right after that. MUSHclient doesn't redraw the output window until text comes in or Redraw, WindowShow, or one other I forget is called.

'Soludra' on Achaea

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

Posted by Ashass   (50 posts)  [Biography] bio
Date Sun 28 Nov 2010 07:30 AM (UTC)  quote  ]

Amended on Sun 28 Nov 2010 07:33 AM (UTC) by Ashass

Message
WindowText win, "Status", "Quest Log", 0, 5, 10, 0, 0,ColourNameToRGB ("blue"), false


is now

WindowText win, "Status", "Quest Log", 5, 10, 0, 0,ColourNameToRGB ("blue"), false


No error, but no text actually shows.
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Sun 28 Nov 2010 07:25 AM (UTC)  quote  ]
Message
I'm not too familiar with VBscript, but there are two things you might want to try.

1) Put it on a single line. A recent issue had to do with formatting, so it can't hurt to try.

2) Put parentheses around the arguments. I know VBscript has a weird sub/function distinction, but it can't hurt to try either.

'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.


5,031 views.

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

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[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]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]