Buttons
From VbGORE Visual Basic Online RPG Engine
Introduction
This short tutorial will show you how to add buttons to your vbGORE game. The following will focus on opening the stats window without using the hotkey.
Adding the code
Firsty, open your current skin.dat and add the following code:
Then open your skin.ini and add: <vb>[QUICKMENU] ScreenX=0 ScreenY=553 ScreenWidth=32 ScreenHeight=32 Grh=43 </vb> This is necessary to add the pic in the quickmenubar.
Change the Grh to suit your image.
Now, open GameClient.vbp.
Find: <vb>Function Input_Mouse_LeftClick_Window(ByVal WindowIndex As Byte) As Byte</vb>
After: <vb>Select Case WindowIndex</vb>
Add: <vb> Case QuickMenuWindow
With GameWindow.QuickMenu
If Engine_Collision_Rect(MousePos.X, MousePos.Y, 1, 1, .Screen.X, .Screen.Y, .Screen.Width, .Screen.Height) Then
Input_Mouse_LeftClick_Window = 1
LastClickedWindow = QuickMenuWindow
If ShowGameWindow(StatWindow) = 0 Then
ShowGameWindow(StatWindow) = 1
Else
ShowGameWindow(StatWindow) = 0
End If
LastClickedWindow = 0
End If
End With</vb>
Find: <vb>'Set scroll pixels per frame</vb>
Add: <vb>ShowGameWindow(QuickMenuWindow) = 1</vb>
Replace: <vb>'Important: Windows are ordered by priority, where 1 = highest! Public Const AmountWindow As Byte = 1 Public Const MenuWindow As Byte = 2 Public Const NPCChatWindow As Byte = 3 Public Const TradeWindow As Byte = 4 Public Const WriteMessageWindow As Byte = 5 Public Const ViewMessageWindow As Byte = 6 Public Const MailboxWindow As Byte = 7 Public Const InventoryWindow As Byte = 8 Public Const ShopWindow As Byte = 9 Public Const BankWindow As Byte = 10 Public Const StatWindow As Byte = 11 Public Const ChatWindow As Byte = 12 Public Const QuickBarWindow As Byte = 13 Public Const NumGameWindows As Byte = 13</vb>
With: <vb>'Important: Windows are ordered by priority, where 1 = highest! Public Const AmountWindow As Byte = 1 Public Const MenuWindow As Byte = 2 Public Const NPCChatWindow As Byte = 3 Public Const TradeWindow As Byte = 4 Public Const WriteMessageWindow As Byte = 5 Public Const ViewMessageWindow As Byte = 6 Public Const MailboxWindow As Byte = 7 Public Const InventoryWindow As Byte = 8 Public Const ShopWindow As Byte = 9 Public Const BankWindow As Byte = 10 Public Const StatWindow As Byte = 11 Public Const ChatWindow As Byte = 12 Public Const QuickMenuWindow As Byte = 13 Public Const QuickBarWindow As Byte = 14 Public Const NumGameWindows As Byte = 14</vb>
Find: <vb>Private Sub Engine_Render_GUI_Window(ByVal WindowIndex As Byte)</vb>
After: <vb>Select Case WindowIndex</vb>
Add: <vb> Case QuickMenuWindow
With GameWindow.QuickMenu
Engine_Render_Grh .SkinGrh, .Screen.X, .Screen.Y, 0, 1, True, GUIColorValue, GUIColorValue, GUIColorValue, GUIColorValue
End With</vb>
Find: <vb>Public Sub Engine_Init_GUI(Optional ByVal LoadCustomPos As Byte = 1)</vb>
Add: <vb> 'Load Quickmenu
With GameWindow.QuickMenu
.Screen.X = Val(Var_Get(t, "QUICKMENU", "ScreenX"))
.Screen.Y = Val(Var_Get(t, "QUICKMENU", "ScreenY"))
.Screen.Width = Val(Var_Get(s, "QUICKMENU", "ScreenWidth"))
.Screen.Height = Val(Var_Get(s, "QUICKMENU", "ScreenHeight"))
Engine_Init_Grh .SkinGrh, Val(Var_Get(s, "QUICKMENU", "Grh"))
End With</vb>
Find: <vb>Private Type KeyDefinitions</vb>
Add: <vb> QuickMenuWindow As Integer</vb>
Find: <vb>Private Type WindowQuickBar 'Quick bar window
Screen As Rectangle Image(1 To 12) As Rectangle SkinGrh As Grh
End Type</vb>
Below Add: <vb>Private Type QuickMenuWindow 'Quick Menu window
Screen As Rectangle SkinGrh As Grh
End Type</vb>
Find: <vb> Public Type GameWindow 'List of all the different game windows
QuickBar As WindowQuickBar
Inventory As WindowInventory
Shop As WindowInventory
Mailbox As WindowMailbox
ViewMessage As WindowMessage
WriteMessage As WindowMessage
Amount As WindowAmount
Menu As WindowMenu
ChatWindow As ChatWindow
StatWindow As StatWindow
Bank As WindowInventory
NPCChat As WindowNPCChat
Trade As TradeWindow
QuestLog As dQuestLogWindow 'A link to the quest window information</vb>
Below Add: <vb> QuickMenu As QuickMenuWindow</vb>
That's all! Now you know how to do add a window and a button at vbGore!