First Create a new window following the
adding windows tutorial. From here on wherever you see WINDOW that will be the name of the window you made in that tutorial. Make sure your window has the following type data.
Code:
Public Type WINDOW
Screen As Rectangle
SkinGrh As Grh
TargetName As String
End Type
Find:
Code:
Public Type DataCode
Below Add:
Code:
User_ClickMenu As Byte
Find:
Code:
'Packet IDs
Scroll to the bottom of the list and add:
Code:
.User_ClickMenu = ###
Where ### is the number after the previous lines number.
Find:
Code:
Case .User_Trade_UpdateTrade: Data_User_Trade_UpdateTrade rBuf
Below Add:
Code:
Case .User_ClickMenu: Data_User_ClickMenu rBuf
In TCP.bas add:
Code:
Sub Data_User_ClickMenu(ByRef rBuf As DataBuffer)
Dim X As Integer
Dim Y As Integer
X = rBuf.Get_Integer
Y = rBuf.Get_Integer
With GameWindow.WINDOW
.TargetName = rBuf.Get_String
.Screen.X = Engine_TPtoSPX(X) + 16
.Screen.Y = Engine_TPtoSPY(Y) + 16
End With
ShowGameWindow(RightClick) = 1
End Sub
In:
Code:
Private Sub Engine_Render_GUI_Window
Under:
Code:
Select Case WindowIndex
Add:
Code:
Case WINDOW
With GameWindow.WINDOW
Engine_Render_Grh .SkinGrh, .Screen.X, .Screen.Y, 0, 0, False, GUIColorValue, GUIColorValue, GUIColorValue, GUIColorValue
Engine_Render_Text Font_Default, .TargetName, .Screen.X + 5, .Screen.Y + 5, D3DColorARGB(255, 100, 10, 10)
End With
NOTE: You may have already added something here while making the window make sure you use that one if you did.
Find:
Code:
'No windows clicked, so a tile click will take
Above add:
Code:
'*** Check for clickmenu
If ShowGameWindow(WINDOW) = 1 Then ShowGameWindow(WINDOW) = 0
NOTE: You will have to do this twice you will find the No windows clicked comment in the right click even and the left click even.
The following codes are optional they will make it so that if the user clicks on a window it hides the right click menu. If you go to add click events later on you will have to do a bit of work in these sections. To make the window still disappear but your window click events work.
Under:
Code:
Function Input_Mouse_RightClick_Window
Add:
Code:
'***Check for ClickMenu open
If ShowGameWindow(WINDOW) = 1 Then ShowGameWindow(WINDOW) = 0
Under:
Code:
Function Input_Mouse_LeftClick_Window
Add:
Code:
'***Check for ClickMenu open
If ShowGameWindow(WINDOW) = 1 Then ShowGameWindow(WINDOW) = 0