Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EA 3.0.10] Moveable GUI Windows


Ertzel
 Share

Recommended Posts

This should work in any version that uses the same rendering as EA 3.0.10 but its only been tested in .10

This tutorial will show you how to make GUI_INVENTORY, GUI_SPELLS, GUI_CHARACTER, GUI_PARTY, GUI_OPTIONS all moveable. To make any of the other GUI windows moveable just follow the steps used for the ones in this tutorial but for the other GUIs.

It is all done client side. First open modInput and at the top below```
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
```add```
Public mouseClicked As Boolean

Public mouseState As GUIType
```Then replace all of```
Public Sub HandleMouseMove(ByVal x As Long, ByVal y As Long, ByVal Button As Long)
```with```
Public Sub HandleMouseMove(ByVal x As Long, ByVal y As Long, ByVal Button As Long)

Dim I As Long

' Set the global cursor position

GlobalX = x

GlobalY = y

GlobalX_Map = (TileView.Left * PIC_X) + Camera.Left

GlobalY_Map = GlobalY + (TileView.Top * PIC_Y) + Camera.Top

' GUI processing

If Not InMapEditor And Not hideGUI Then

For I = 1 To GUI_Count - 1

If (x >= GUIWindow(I).x And x <= GUIWindow(I).x + GUIWindow(I).Width) And (y >= GUIWindow(I).y And y <= GUIWindow(I).y + GUIWindow(I).Height) Then

If GUIWindow(I).Visible Then

Select Case I

Case GUI_CHAT, GUI_BARS, GUI_MENU

' Put nothing here and we can click through them!

Case GUI_INVENTORY, GUI_SPELLS, GUI_CHARACTER, GUI_PARTY, GUI_OPTIONS

' Moveable GUI if right clicked

Case Else

Exit Sub

End Select

End If

End If

Next

End If

' Handle the events

CurX = TileView.Left + ((x + Camera.Left) \ PIC_X)

CurY = TileView.Top + ((y + Camera.Top) \ PIC_Y)

If InMapEditor Then

If Button = vbLeftButton Or Button = vbRightButton Then

Call MapEditorMouseDown(Button, x, y)

End If

End If

If mouseClicked Then

If mouseState = GUI_INVENTORY Then

GUIWindow(GUI_INVENTORY).x = GlobalX

GUIWindow(GUI_INVENTORY).y = GlobalY

ElseIf mouseState = GUI_SPELLS Then

GUIWindow(GUI_SPELLS).x = GlobalX

GUIWindow(GUI_SPELLS).y = GlobalY

ElseIf mouseState = GUI_CHARACTER Then

GUIWindow(GUI_CHARACTER).x = GlobalX

GUIWindow(GUI_CHARACTER).y = GlobalY

ElseIf mouseState = GUI_PARTY Then

GUIWindow(GUI_PARTY).x = GlobalX

GUIWindow(GUI_PARTY).y = GlobalY

ElseIf mouseState = GUI_OPTIONS Then

GUIWindow(GUI_OPTIONS).x = GlobalX

GUIWindow(GUI_OPTIONS).y = GlobalY

End If

End If

End Sub
```

Replace all of```
Public Sub HandleMouseDown(ByVal Button As Long)
```with```
Public Sub HandleMouseDown(ByVal Button As Long)

Dim I As Long

' GUI processing

If Not InMapEditor And Not hideGUI Then

For I = 1 To GUI_Count - 1

If (GlobalX >= GUIWindow(I).x And GlobalX <= GUIWindow(I).x + GUIWindow(I).Width) And (GlobalY >= GUIWindow(I).y And GlobalY <= GUIWindow(I).y + GUIWindow(I).Height) Then

If GUIWindow(I).Visible Then

Select Case I

Case GUI_CHAT, GUI_BARS

' Put nothing here and we can click through the

Case GUI_INVENTORY

Inventory_MouseDown Button

mouseState = GUI_INVENTORY

If Button = vbRightButton Then mouseClicked = True

Exit Sub

Case GUI_SPELLS

Spells_MouseDown Button

mouseState = GUI_SPELLS

If Button = vbRightButton Then mouseClicked = True

Exit Sub

Case GUI_MENU

Menu_MouseDown Button

Exit Sub

Case GUI_HOTBAR

Hotbar_MouseDown Button

Exit Sub

Case GUI_CHARACTER

Character_MouseDown

mouseState = GUI_CHARACTER

If Button = vbRightButton Then mouseClicked = True

Exit Sub

Case GUI_CURRENCY

Currency_MouseDown

Exit Sub

Case GUI_DIALOGUE

Dialogue_MouseDown

Exit Sub

Case GUI_SHOP

Shop_MouseDown

Exit Sub

Case GUI_PARTY

Party_MouseDown

mouseState = GUI_PARTY

If Button = vbRightButton Then mouseClicked = True

Exit Sub

Case GUI_OPTIONS

Options_MouseDown

mouseState = GUI_OPTIONS

If Button = vbRightButton Then mouseClicked = True

Exit Sub

Case GUI_TRADE

Trade_MouseDown

Exit Sub

Case GUI_EVENTCHAT

Chat_MouseDown

Exit Sub

Case Else

Exit Sub

End Select

End If

End If

Next

' check chat buttons

If Not inChat Then

ChatScroll_MouseDown

End If

End If

' Handle events

If InMapEditor Then

Call MapEditorMouseDown(Button, GlobalX, GlobalY, False)

Else

' left click

If Button = vbLeftButton Then

' targetting

Call PlayerSearch(CurX, CurY)

'FindTarget

' right click

ElseIf Button = vbRightButton Then

If ShiftDown Then

' admin warp if we're pressing shift and right clicking

If GetPlayerAccess(MyIndex) >= 2 Then AdminWarp CurX, CurY

End If

End If

End If

If frmEditor_Events.Visible Then frmEditor_Events.SetFocus

End Sub
```
And replace all of```
Public Sub HandleMouseUp(ByVal Button As Long)
```with```
Public Sub HandleMouseUp(ByVal Button As Long)

Dim I As Long

' GUI processing

If Not InMapEditor And Not hideGUI Then

For I = 1 To GUI_Count - 1

If (GlobalX >= GUIWindow(I).x And GlobalX <= GUIWindow(I).x + GUIWindow(I).Width) And (GlobalY >= GUIWindow(I).y And GlobalY <= GUIWindow(I).y + GUIWindow(I).Height) Then

If GUIWindow(I).Visible Then

Select Case I

Case GUI_CHAT, GUI_BARS

' Put nothing here and we can click through the

Case GUI_INVENTORY

Inventory_MouseUp

mouseClicked = False

Case GUI_SPELLS

Spells_MouseUp

mouseClicked = False

Case GUI_MENU

Menu_MouseUp

Case GUI_HOTBAR

Hotbar_MouseUp

Case GUI_CHARACTER

Character_MouseUp

mouseClicked = False

Case GUI_CURRENCY

Currency_MouseUp

Case GUI_DIALOGUE

Dialogue_MouseUp

Case GUI_SHOP

Shop_MouseUp

Case GUI_PARTY

Party_MouseUp

mouseClicked = False

Case GUI_OPTIONS

Options_MouseUp

mouseClicked = False

Case GUI_TRADE

Trade_MouseUp

Case GUI_EVENTCHAT

Chat_MouseUp

End Select

End If

End If

Next

End If

' Stop dragging if we haven't catched it already

DragInvSlotNum = 0

DragBankSlotNum = 0

DragSpell = 0

' reset buttons

resetClickedButtons

' stop scrolling chat

ChatButtonUp = False

ChatButtonDown = False

End Sub
```and above```
SendChangeInvSlots DragInvSlotNum, invSlot
```add```
mouseClicked = False
```Then find```
picAdmin.Left = 544
```and under it add```
mouseClicked = False
```
Link to comment
Share on other sites

  • 1 month later...
I didn't feel like working it out so I used this to start my movable windows. You need to make it so the windows have boundaries and cannot get lost. Also make a variable to store the mouse offset```
MouseOffset.x = GlobalX - GUIWindow(i).x
```when you click the window so it doesn't snap to the top corner of the window.
Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...