Page 1 of 1

GUI Usage

Posted: May 26th, 2010, 5:23 pm
by AndyLangel
Hello Again,

I am wondering how one uses all those nice gui functions, i know how to use a few, so i will post how to use the ones i know, for the rest, you think i could get some help? Kinda curious, want to use them :)

showgui: This function allows you to automatically display your gui on such things as triggers.

Useage:

Code: Select all

level_trigger_1 = [showgui ExampleGUI]
newgui: Pretty simple, makes a new gui menu. You can link the gui menu to show on a trigger, or you can bring it up directly through consol commands.

Useage:

Code: Select all

level_trigger_1 = [showgui ExampleGUI]

newgui ExampleGUI [
   //Other gui code goes here...
]
guitext: Another simple gui function that lets you put text into your gui menu.

Useage:

Code: Select all

level_trigger_1 = [showgui ExampleGUI]

newgui ExampleGUI [
   guitext "This text will appear in your gui menu!"
]
guibar: A simple dividing bar for you gui menu.

Useage:

Code: Select all

level_trigger_1 = [showgui ExampleGUI]

newgui ExampleGUI [
   guitext "Now there is a bar below this text!"
   guibar
   guitext "And a bar above this text!"
]
guilist: A function for lists in your gui menu, this one can get a tad bit confusing when using multiple levels of lists, or when your lists are long.

Useage:

Code: Select all

level_trigger_1 = [showgui ExampleGUI]

newgui ExampleGUI [
  guitext "Now we will demonstrate a gui list!"
  guibar
  guilist [
      guitext "Gui lists are very useful!"
      guibar
      guitext "And almost all gui functions can be used in them!"
   ]
]
guibutton: This is a function for a gui button, once again a very useful function, and very easy to use.

Useage:

Code: Select all

gold = 0 //You'll see why...

level_trigger_1 = [showgui ExampleGUI]

newgui ExampleGUI [
   guitext "Now we will demonstrate a gui button!"
   guibar
   guibutton "CLICK ME!" [
      //Here is where you can add arguments and functions for the button, i will demonstrate a simple IF...THEN function...
      If ( >= $gold 5) [
         echo "You have more than 5 gold!"
      ] [ //Not so sure this method works...
      echo "You have less than 5 gold :("
      ]
   ]
   guibar
   guitext "Now we will make one in a guilist!"
   guibar
   guilist [
      guibutton "CLICK ME TOO!" [
         echo "Thank you! Now you can has some gold!"
         gold = ( + $gold 5)
      ]
   ]
]
As you can see, things can get pretty messy, so make sure you use comments to keep track of things- you can also use Notepad++, which helps you keep track of your ['s and ]'s, which is VERY important!

These are all the gui functions that i know how to use, so if you can contribute i still need to know how to use:

* cleargui
* guikeyfield
* guirolloveraction
* guirollovername
* guilistslider
* guinameslider
* guistayopen
* guistrut

Thank you, and i hope this helps! and i hope people can help as well! :D

EDIT::

I have found the proper uses for the following gui functions, though, i still have yet to use them in any of my scripts- once i use them, and can assure that they are used right, i will add them to this list. The functions i now know how to use are:

* guiautotab
* cleargui
* guititle
* guiimage
* guislider
* guicheckbox
* guiradio
* guitab
* guifield

I still have to test all of these functions, so please allow a few days before i will be able to update this post on how to use them. However, if you would like to post a guide on how to use a function i have not covered, feel free to contribute!

Also, once i know how to use all these functions, i will add a GUI tutorial to the tutorial page- Also, i will be putting a tutorial up on how to make your own complex shop script, and i will tell you where it goes :D you can even expect that by tomorrow!

Re: GUI Usage

Posted: May 26th, 2010, 7:09 pm
by arcones
cleargui
That, is for clicking a button equals removing the gui. Helpful with inventory's and removing NPC chat's.
guirolloveraction
guirollovername
Those would be (I'm assuming) a menu such as one with pictures...
guitab
This would be used if you wanted a second inventory/diary/quest log/ etc. I haven't fine tuned it yet, but I have a good idea of where it goes.

Hope that helps!
Arc :geek:

Re: GUI Usage

Posted: May 26th, 2010, 7:28 pm
by AndyLangel
Thanks for the help Arc!

I will look into those functions- but from the wiki:

guiclear basically just closes the gui box- or "Hides the menu"

I am not sure about guirolloveraction or guirollovername- but your guesses might be somewhat accurate :P ill look into it though.

And guitab obviously makes a tab :P though, much like you, i have yet to perfect it. The wiki states it as this: "guitab S
Creates a new menu tab with title S. Note: has no effect if used within a guilist." I have had troubles with tabs in the past, so i want to make sure i can use this without error before i post anything on its useage.

Thanks for the contribution! :D

Re: GUI Usage

Posted: May 26th, 2010, 7:35 pm
by arcones
Well, I'm glad I can help in any way!
Andy wrote:And guitab obviously makes a tab :P though, much like you, i have yet to perfect it. The wiki states it as this: "guitab S
Creates a new menu tab with title S. Note: has no effect if used within a guilist." I have had troubles with tabs in the past, so i want to make sure i can use this without error before i post anything on its useage.
I tried it in a Second inventory form, and it ended up taking over my inventory as well :lol:

So I figured I put it in the wrong spot...

This was taken from Gobologna's shop script:

Code: Select all

newgui Inventory [
guibutton "Back" "cleargui 1"
guibar
guitext ( format "You have %1 moneys in your wallet." $money )
guitext ( format "You have %1 pies.  Yum." $pie )
guitext ( format "You have %1 swords.  Not that you can use them..." $sword )
guitext ( format "You have %1 treasures.  Lucky you!" $treasure )
]

newgui main [
   guilist [
      guilist [
         guibutton "Inventory" "showgui Inventory"
      ]
   ]
   guibar
   @main
]
:)