Ertzel Posted September 29, 2012 Author Share Posted September 29, 2012 This should work in any version that uses the same rendering as EA 3.0.10 but its only been tested in .10This 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 BooleanPublic 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 positionGlobalX = xGlobalY = yGlobalX_Map = (TileView.Left * PIC_X) + Camera.LeftGlobalY_Map = GlobalY + (TileView.Top * PIC_Y) + Camera.Top' GUI processingIf Not InMapEditor And Not hideGUI ThenFor I = 1 To GUI_Count - 1If (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) ThenIf GUIWindow(I).Visible ThenSelect Case ICase 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 clickedCase ElseExit SubEnd SelectEnd IfEnd IfNextEnd If' Handle the eventsCurX = TileView.Left + ((x + Camera.Left) \ PIC_X)CurY = TileView.Top + ((y + Camera.Top) \ PIC_Y)If InMapEditor ThenIf Button = vbLeftButton Or Button = vbRightButton ThenCall MapEditorMouseDown(Button, x, y)End IfEnd IfIf mouseClicked ThenIf mouseState = GUI_INVENTORY ThenGUIWindow(GUI_INVENTORY).x = GlobalXGUIWindow(GUI_INVENTORY).y = GlobalYElseIf mouseState = GUI_SPELLS ThenGUIWindow(GUI_SPELLS).x = GlobalXGUIWindow(GUI_SPELLS).y = GlobalYElseIf mouseState = GUI_CHARACTER ThenGUIWindow(GUI_CHARACTER).x = GlobalXGUIWindow(GUI_CHARACTER).y = GlobalYElseIf mouseState = GUI_PARTY ThenGUIWindow(GUI_PARTY).x = GlobalXGUIWindow(GUI_PARTY).y = GlobalYElseIf mouseState = GUI_OPTIONS ThenGUIWindow(GUI_OPTIONS).x = GlobalXGUIWindow(GUI_OPTIONS).y = GlobalYEnd IfEnd IfEnd 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.SetFocusEnd 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 processingIf Not InMapEditor And Not hideGUI ThenFor I = 1 To GUI_Count - 1If (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) ThenIf GUIWindow(I).Visible ThenSelect Case ICase GUI_CHAT, GUI_BARS' Put nothing here and we can click through theCase GUI_INVENTORYInventory_MouseUpmouseClicked = FalseCase GUI_SPELLSSpells_MouseUpmouseClicked = FalseCase GUI_MENUMenu_MouseUpCase GUI_HOTBARHotbar_MouseUpCase GUI_CHARACTERCharacter_MouseUpmouseClicked = FalseCase GUI_CURRENCYCurrency_MouseUpCase GUI_DIALOGUEDialogue_MouseUpCase GUI_SHOPShop_MouseUpCase GUI_PARTYParty_MouseUpmouseClicked = FalseCase GUI_OPTIONSOptions_MouseUpmouseClicked = FalseCase GUI_TRADETrade_MouseUpCase GUI_EVENTCHATChat_MouseUpEnd SelectEnd IfEnd IfNextEnd If' Stop dragging if we haven't catched it alreadyDragInvSlotNum = 0DragBankSlotNum = 0DragSpell = 0' reset buttonsresetClickedButtons' stop scrolling chatChatButtonUp = FalseChatButtonDown = FalseEnd 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 More sharing options...
SkywardRiver Posted September 29, 2012 Share Posted September 29, 2012 Looks amazing! I'll put it in my version right now! I'll let you know If I find any sort of bugs. Good job manEnd Sub[[/color]code]Public Sub Inventory_MouseUp()This might confuse some people Link to comment Share on other sites More sharing options...
JohnPony Posted September 29, 2012 Share Posted September 29, 2012 This is in the Q&A board xD Link to comment Share on other sites More sharing options...
SkywardRiver Posted September 29, 2012 Share Posted September 29, 2012 That might confuse some people too XD Link to comment Share on other sites More sharing options...
Ertzel Posted September 29, 2012 Author Share Posted September 29, 2012 Ya, my bad. I put it in the wrong board lol.Can an admin move this to the tutorial section plz. Link to comment Share on other sites More sharing options...
SkywardRiver Posted September 29, 2012 Share Posted September 29, 2012 This works brilliantly, thanks a ton dude! Link to comment Share on other sites More sharing options...
hisherwin Posted September 30, 2012 Share Posted September 30, 2012 Ha , This work only on DX8 right?! Well that's a good one Ertzel Link to comment Share on other sites More sharing options...
Link Posted September 30, 2012 Share Posted September 30, 2012 Well done, but isn't this already implemented in a couple of custom versions? Link to comment Share on other sites More sharing options...
Ertzel Posted September 30, 2012 Author Share Posted September 30, 2012 Not sure, its not in EA and I didn't see any tutorials on how to do it and saw a couple people asking about it so decided to put up the tutorial. Link to comment Share on other sites More sharing options...
Spainion Posted October 31, 2012 Share Posted October 31, 2012 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 More sharing options...
Snirf Posted January 17, 2013 Share Posted January 17, 2013 Sorry. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now