Single menu

From VbGORE Visual Basic Online RPG Engine

Note: depending on how many windows you want to show on a single GUI, you will have to repeat most of the steps.  If you have any questions or comments post it on the forums and I'll take a look.  This guide was written from memory and may generate an error.  If you do get one post it on the forums and I'll add what I forgot. :p

Step 1: Draw your GUI You want to make sure they are the same width and height for consistancy. Also remember to edit the Grh sheets.

Step 2: Edit the .ini and .dat files (in notepad if it asks) They are located in the "Data/Skins/" Directory.

Add This to the .ini file:

[GROUPWINDOW]
ScreenX=0
ScreenY=0
ScreenWidth=<WHATEVER YOUR NEW WIDTH IS>
ScreenHeight<WHATEVER YOUR NEW HEIGHT IS>

And Add this to the .dat file:

[GROUPWINDOW]
ScreenX=0
ScreenY=0

This is so that all the windows share the same x and y cords on the GUI.

Now remove the ScreenX, ScreenY, ScreenWidth, and ScreenHeight for each of the menus you're turning into one.

Step 3: Client editing part 1 Open up the Client and open the TileEngine. Find:

Public Type GameWindow          'List of all the different game windows

And put something like this inside the Type declare:

    GroupGUI As Rectangle

Now Before this you will see the lists of all the windows. Remove This from each of the menus your converting into a single screen:

	Screen As Rectangle


Next open "Engine_Init_GUI" which is inside the TileEngine. Throughout the code you will find the seperate menus that look simular to this:

        If LoadCustomPos Then
            .Screen.X = Val(Var_Get(t, "STATWINDOW", "ScreenX"))
            .Screen.Y = Val(Var_Get(t, "STATWINDOW", "ScreenY"))
        Else
            .Screen.X = Val(Var_Get(s, "STATWINDOW", "ScreenX"))
            .Screen.Y = Val(Var_Get(s, "STATWINDOW", "ScreenY"))
        End If
        .Screen.Width = Val(Var_Get(s, "STATWINDOW", "ScreenWidth"))
        .Screen.Height = Val(Var_Get(s, "STATWINDOW", "ScreenHeight"))

Remove the entire If Statement. and any line that references to .Screen. So the entire above would be removed. If this removes everything between the With statement, you might as well remove the entire thing. Make sure you don't remove .Screen2. if you're dealing with the QuestLog Addon.

Next add this line of code within that Sub:

    'Load the X and Y of the group menu
    With GameWindow.GroupGUI
        If LoadCustomPos Then
            .X = Val(Var_Get(t, "GROUPWINDOW", "ScreenX"))
            .Y = Val(Var_Get(t, "GROUPWINDOW", "ScreenY"))
        Else
            .X = Val(Var_Get(s, "GROUPWINDOW", "ScreenX"))
            .Y = Val(Var_Get(s, "GROUPWINDOW", "ScreenY"))
        End If
        .Width = Val(Var_Get(s, "GROUPWINDOW", "ScreenWidth"))
        .Height = Val(Var_Get(s, "GROUPWINDOW", "ScreenHeight"))
    End With

Now load up the "Engine_Render_GUI_Window" inside of the TileEngine. We want to render to location of the menus all at the same spot so change for each of the menus: So find each reference to the Screen and change it to the GroupGUI:

from

Engine_Render_Grh .SkinGrh, Screen.X, Screen.Y, 0, 1, True

to

Engine_Render_Grh .SkinGrh, GameWindow.GroupGUI.X, GameWindow.GroupGUI.Y, 0, 1, True

as an example.


Now if you have buttons on your GUI add this inside the With for each of the menus, my exmaple is Questlog, Inventory, and Stats:

                If Engine_Collision_Rect(MousePos.X, MousePos.Y, 1, 1, GameWindow.GroupGUI.X + 6, GameWindow.GroupGUI.Y + 52, 74, 29) Then
                    If MouseLeftDown > 0 Then
                        ShowGameWindow(InventoryWindow) = 1
                        ShowGameWindow(QuestLogWindow) = 0
                        LastClickedWindow = InventoryWindow
                        Exit Sub
                    End If
                End If

YOU WILL HAVE TO CHANGE THE ABOVE CODE!!!! change the +6 to the x location of the button and the +52 to the y location of the button. don't forget to change the width and height too (74 and 29). Also make the ShowGameWindow = 1 for the window that's being open and = 0 for the current menu. And the LastclickedWindow should be = to the window that is being opened.

Step 4: Editing the Input

Now we deal with the input commands and moving the window around. Open the Input and find "Input_handlecommands." Change any of your / commands that open ant windows in your Single GUI to function simular to this:

    ElseIf Input_GetCommand("/QUEST") Then
            If (ShowGameWindow(QuestLogWindow) = 0) Then
                ShowGameWindow(QuestLogWindow) = 1
                ShowGameWindow(InventoryWindow) = 0
                ShowGameWindow(StatWindow) = 0
                LastClickedWindow = QuestLogWindow
            Else
                ShowGameWindow(QuestLogWindow) = 0
                LastClickedWindow = 0
            End If

Now just go around and anywhere it deals with the Screen.X and/or Screen.Y of the menu change it to GameWindow.GroupGUI.X and/or GameWindow.GroupGUI.Y and repeat for ScreenWidth and ScreenHeight. For exmaple inside of "Input_Mouse_Move": replace the code inside each case where a window you want in the single GUI with the following code:

	        With GameWindow.GroupGUI
                    .X = .X + MousePosAdd.X
                    .Y = .Y + MousePosAdd.Y
                    If WindowsInScreen Then
                        If .X < 0 Then .X = 0
                        If .Y < 0 Then .Y = 0
                        If .X > ScreenWidth - .Width Then .X = ScreenWidth - .Width
                        If .Y > ScreenHeight - .Height Then .Y = ScreenHeight - .Height
                    End If
                End With

Don't forget to run through the "Input_Mouse_Right_Click_Window" and "Input_Mouse_Left_Click_Window" editing the .Screen. to GameWindow.GroupGUI.

Step 5: Auto-save window position

Open up "General" and find "Game_Config_Save" Remove any reference to the ScreenX and ScreenY of menus you've merged and at the end add these lines:

        Var_Write t, "GROUPWINDOW", "ScreenX", Str$(.GroupGUI.X)
        Var_Write t, "GROUPWINDOW", "ScreenY", Str$(.GroupGUI.Y)

There ya go. It should be done. Now pat yourself on the back :)

Personal tools