GUI Editor

» Siedler Map Source Forum » Siedler DEdK Script Forum » GUI Editor

Seiten: 1

Qba331PL
#1
11.06.2018 21:48
Beiträge: 102

GUI Editor

Hi!

I downloaded thah GUI editor and I translated guide but I still have some problems. I created one widget and button but I need help with 3 things:

-how to implement that new GUI into game/map (step by step)?

-how to open new widget/window after clicking on that created button?

-how to remove/replace widgets

Best regards,
Qba331PL

mcb
#2
11.06.2018 21:59
Beiträge: 1472

1) Use the S5Hook. It has a function that reloads a specific gui xml that can be included in your mapfile.
2) Use XGUIEng functions like XGUIEng.ShowWidget(widgetname, flag)
3) Rightclick->Delete (or something like this)

Qba331PL
#3
11.06.2018 22:31
Beiträge: 102

Zitat von mcb:

3) Rightclick->Delete (or something like this)



I mean using lua. For example - I finished mission in game -> widget disappear.

mcb
#4
11.06.2018 23:44
Beiträge: 1472

XGUIEng.ShowWidget(widgetname, flag)

Qba331PL
#5
12.06.2018 20:07
Beiträge: 102

I don't know how to use S5Hook. Should I copy all that library to script or do something more? I need your help.

mcb
#6
13.06.2018 13:09
Beiträge: 1472

Yes, copy the contents of the file you can download here into your script: http://settlers.pro/s5hook.html
Then you have to call InstallS5Hook() after game start and every time a savegame gets loaded. Luckily i have a comfort script that does this for you: http://www.siedler-maps.de/for...t-Forum/s5HookLoader-20421.htm (use the newest version v0.4) Also copy this into your script (and any of its dependencies). Then add a function you want to get called after the hook gets loded:

table.insert(s5HookLoader.cb, function()
   -- your code here
   S5Hook.LoadGUI("data/menu/projects/ingame.xml") -- this is the call that loads a new gui (with the path to the standard gui xml, change it to the path of your file)
   s5HookLoader.xmlLoaded() -- say my comfort that a gui got loaded, some scripts need a callback one tick later
end)


Add this inside the FMA, and call s5HookLoader.init() after it.

For the Path: You can use any path you like on your computer (like "C:/Users/Username/Documents/s5gui.xml" ) but when you upload the map you want to pack it inside the s5x. Use the bba-tool for this, by unpacking your map, adding your gui file to the unpacked folder (to maps/externalmap/mygui.xml) and change the path to "data/maps/externalmap/mygui.xml", then repacking it with the bbatool. The modified mapfile should not be loaded&saved again from the mapeditor, because any aditional files are lost upon saving.

Seiten: 1

SiteEngine v1.5.0 by nevermind, ©2005-2007
Design by SpiderFive (www.siedler-games.de) - English translation by juja

Impressum