Page 1 of 2
html-like in-game help widget beta 2
Posted: 29 Sep 2007, 14:29
by BigHead
Features:
*word wrapping
*vertical scrolling
*easily customizable (background color, size, etc ...) and modification-friendly
*support for "welcome" page that is displayed only the first time user starts the widget
*can be used for fullscreen help as well as in-game windowed unit guide
*there are 6 tags:
<title>
<image> - "floating" is supported
<link> - equivalent to <a href>
<heading> - equivalent to <h1>, <h2> ... you can set the size
<li>
<include> - includes another page eg.:navigation at the bottom
How-to:
Help API widget provides you with four call-outs:
Script.LuaUI.setPageOptions(options) - allows you to change the font size, colors, widget position and many other things
Script.LuaUI.displayPage(page) - displays the page
Script.LuaUI.isHelpVisible() - true if a page is displayed
Script.LuaUI.setWelcomePage(page) - this page will be shown only once
See gui_example_help.lua (it's disabled by default) to see the help in action.
Unit-guide:
For unit guide you should put something like this into drawScreen()
Code: Select all
if onlyOneUnitIsSelected() then
drawButtonThatWillShowHelpForThatUnit()
end
This widget needs your help!
I lack any talent at designing. That's why the buttons and the window look so bad. There's a simple drawFrame() method which draw everything exept the page content. I need someone to modify that method to make the widget look better.
This is just a beta version. Do not include this into your mod yet!
Report bugs please.
However remember that the syntax is very strict so triple-check your syntax before posting.
Changelog:
beta 1 -> beta 2:
No need to use help.lua anymore. You can now use provided API to display your help pages
Download:
http://www.unknown-files.net/3583/ingame_help_widget/
Posted: 29 Sep 2007, 15:52
by SinbadEV
Okay, That is teh awesome, I assume the images can either be inline, or float left or right... which is so incredibly simple it's awesome... I'm only marginally confused as to why not use actual HTML keywords but I can assume it's so people don't expect other html things to work.
I'm not sure how dynamic the content your making would be but My Suggestion for A first implementation would be, "Press Some Key While Hovering Over An item to get help on it" Then, for example, if you pressed / while hovering over the build menu it would bring up a Build Menu Help (aka describing how to build, there would be 2 of these, one for inside builders and one for outside builders...) then it would also have a link to help on the unit you were hovering over at the time like
The "Factory" Build Menu
In order to build new unit with this menu just click on one of the images and it will add it to the factories build queue. When all prior units in queue are completed, construction of this unit will begin. New units built by this factory will be assigned the group number and the move, attack, defend and patrol orders of this factory.
Where you looking for specific help on Advanced Kbot Factory?
Where you looking for specific help on Construction Kbot?
Where you looking for general help on Building Units?
Posted: 29 Sep 2007, 16:45
by Warlord Zsinj
This really is excellent.
I would probably implement it into my mod so that when you hover your mouse over a buildpic, this pops up near your cursor, and then if you click the window, it pops out with more information.
Posted: 29 Sep 2007, 22:25
by KDR_11k
It looks like you are trying to expand, would you like to:
- Porc instead
- Build more mexes
- MAEK FLASH!
Posted: 30 Sep 2007, 00:02
by Pressure Line
KDR_11k wrote:It looks like you are trying to expand, would you like to:
- Porc instead
- Build more mexes
- SPAEM FLASH!!!
corrected
Posted: 30 Sep 2007, 01:39
by Snipawolf
I do indeed see a tutorial benefitting from this.
Posted: 30 Sep 2007, 11:16
by Warlord Zsinj
It appears this has been licensed under GPL; so I'm concerned about using it in my mod. Can anyone clear this up for me?
If I use this in my mod, would that require the entirety of it to be GPL'ed?
Posted: 30 Sep 2007, 12:48
by Guessmyname
Just the widget I think. Ask Argh, he'd know
Posted: 30 Sep 2007, 12:53
by BigHead
SinbadEV:: HTML isn't used becouse current syntax is easier to parse. The widget you suggest is possible. Actualy it's very easy to do. You need to make Widget:KeyPress() function, put TraceScreenRay() inside to determine what mouse cursor is above and finally call displayPage() to show your help. I'm too busy to do it but it's easy enough to be someones first widget.
Warlord Zsinj: It's wrtiten entirely by me so I can make it whatever license you want.
Plans for next version:
After reading the "Communicating between Gadgets" thread I decided to turn it into a custom event. It will be accessible from all lua so you won't have to override help.lua anymore. Next version will expose this method:
Spring.LuaUI.displayPage(page [,options])
Posted: 30 Sep 2007, 21:43
by Neddie
Warlord Zsinj wrote:It appears this has been licensed under GPL; so I'm concerned about using it in my mod. Can anyone clear this up for me?
If I use this in my mod, would that require the entirety of it to be GPL'ed?
Yes.
You can include files to be read by it and download it separately as a widget, changing the protocol to read from elsewhere.
However, yes, it is Bighead's choice.
Posted: 01 Oct 2007, 18:46
by BigHead
New version is out:
You can use these call-outs from any widget (and propably gadget but I'm not sure) now:
Script.LuaUI.setPageOptions(options) - allows you to change the font size, colors, widget position and many other things
Script.LuaUI.displayPage(page) - displays the page
Script.LuaUI.isHelpVisible() - true if a page is displayed
Script.LuaUI.setWelcomePage(page) - this page will be shown only once
In other words you don't need to modify help.lua anymore. Actually there's no help.lua in this version.
If you have the prevous version installed delete it first!
Download:
http://www.unknown-files.net/3583/ingame_help_widget/
Posted: 01 Oct 2007, 19:00
by jK
BigHead wrote:Script.LuaUI.isHelpVisible() - true if a page is displayed
Sorry to ask, but did you test this? Iirc Script.Lua* doesn't support return values.
Also the Script.* interface is buggy atm, after you called it in a function it exit this or sometimes continues it with a memory overwrite.
So I would recommend the GG[] table. (you can also overwrite the Script.* interface in the enviroment and then link it to the GG[] table)
Posted: 01 Oct 2007, 19:09
by BigHead
I noticed some strange behaviour when using Script.LuaUI. However I fixed it after reading this:
Maelstrom wrote:OK, I worked out the problem. It has two parts.
First, global functions can not have more than one argument. If you want to pass more than one argument to a global function, you have to use a table.
Secondly, the global function has to return something. What it returns isn't always guaranteed to return correctly (It appears strings don't return, while tables do).
Just a heads up to whoever else wants to use global functions.
Boolean values return correctly as well.
Edit: Btw yes, I tested it and it works without any probles.
Posted: 08 Oct 2007, 01:57
by smoth
bighead, to include your widget into gundam what do you require from me?
Posted: 08 Oct 2007, 06:53
by Saktoth
KDR_11k wrote:It looks like you are trying to expand, would you like to:
- SPAEM FLASH!!!
- SPAEM FLASH!!!
- SPAEM FLASH!!!
corrected
Posted: 08 Oct 2007, 07:27
by smoth
OH SHIT, I just noticed your call for assistance. I will be busy till wed but if I do a pretty skin for this, may I have your permission to use this in gundam?
Posted: 08 Oct 2007, 08:30
by BigHead
Of course and remember to post a picture of your work.
Also feel free to ask any questions.
Posted: 08 Oct 2007, 10:17
by smoth
Thank you, I will prioritize this above my gundam and td work for the week so I can quickly get this accomplished. I will do my best man. Work starts thursday morning.
Posted: 30 Nov 2007, 21:54
by Forboding Angel
I was very disappointed to find out that this doesn't work with the svn versions of spring. Could it be updated perchance? This widget was my baby :/
Error in DrawScreen(): [string "LuaUI/Widgets/gui_help_api.lua"]:669: attempt to index upvalue 'options' (a nil value)
Posted: 30 Nov 2007, 22:24
by AF
Have you seen Quantums CA menu widget?