Fragment Posted November 30, 2011 Author Share Posted November 30, 2011 This tutorials expects you to have completed this tutorial:http://www.touchofdeathforums.com/smf/index.php/topic,67261.0.html* * *THANK YOU Sekaru (creator of the above tutorial)Sorry if this fix shouldnt be in the tutorial section, however, I decided to add it for the newer users.**For the purpose of the tutorial fix, I will refer to the frame as picInventory, this is to be replaced by the name of the frame; if you want to fix the Spellbook frame, then you would use picSpells.**Part 1.Unfortunately I cannot state exactly what the first problem with the tutorial was, but I think it was something to do with when you move a frame over another frame it would cause a glitch because you have hold of the frame but if it goes under another frame, it doesnt pick up that you are still moving the frame. Also its no good being able to move the inventory by clicking anywhere because it means you cant move your items around without moving the whole inventory.PART ONE fix starts here>! To solve this, you will need to create a boolean to say that you have clicked the right part of that frame and so even if your mouse isnt directly on the frame because you move it too fast then it will still move to your mouse.>! Go to modGlobals and add this anywhere you like:>! ```'movement boolean for the GUI MOVEMENTPublic MoveCheck As Boolean```This just creates a variable with the options of True or False that is global (this means it can be used in any part of the code even if its not in the current module.>! Now go to the Mouse Down sub of the frameThen you want to change this:Private Sub picInventory_MouseDown(Button As Integer, Shift As Integer, x3 As Single, y3 As Single)>! to this>! Private Sub picInventory_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)(you can leave it as x3 and y3 if you like but you will need to edit the code later on in this fix)>! now change the part>! XM3 = x3 YM3 = y3>! to this>! ``` XM3 = x YM3 = y If (y < (-picInventory.height + 290)) Then MoveCheck = True Else MoveCheck = False End If>! ```^^^This code will just make it so that it only lets you move the frame if you click on the top 20 pixels or so and then it flags the boolean we made earlier to say 'yo mate, he clicked the right part of my frame to move me'. Part2.Another problem I had was that you could move the frame out of the game window and it would be unretrievable with a reset GUI button. (I dont tell you how to make a reset gui button because it would be easy to add if you wanted it, instead I stop the problem before it happens).Also I solved was that if you move your mouse too fast it would loose 'grip' of the frame and sometimes this would mean that the frame would stop 1-100 pixels before the boundaries depending on how fast you move your mouse.PART TWO fix starts here>! First things first, you now need to go from the MouseDown to the MouseMove sub.>! Replace this code:Private Sub picInventory_MouseMove(Button As Integer, Shift As Integer, x3 As Single, y3 As Single)>! with this>! Private Sub picInventory_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)>! Now you want to change this piece of code>! If Button = 1 Then picInventory.left = picInventory.left + x3 - XM3 picInventory.top = picInventory.top + y3 - YM3 End If>! to this``` 'Start Of Gui Movement control If MoveCheck = True Then 'if we have something gripped If Button = 1 Then 'if still holding the mouse If (picInventory.Left + x - XM3) > 0 And (picInventory.Left + x - XM3) < 828 Then picInventory.Left = picInventory.Left + x - XM3 'inside max/min value so set it Else ' they were above or below max/min x value If (picInventory.Left + x - XM3) < 0 Then picInventory.Left = 0 ' they were below min x value,set x to min value Else If (picInventory.Left + x - XM3) > 828 Then picInventory.Left = 828 ' they were above max x value,set x to max value End If End If End If End If If Button = 1 Then 'if still holding the mouse If (picInventory.top + y - YM3) > 0 And (picInventory.top + y - YM3) < 418 Then picInventory.top = picInventory.top + y - YM3 'inside the max/min so set it Else ' they were above or below max/min y value If (picInventory.top + y - YM3) < 0 Then picInventory.top = 0 ' they were below min y value,set y to min value Else If (picInventory.top + y - YM3) > 418 Then picInventory.top = 418 ' they were above max y value,set y to max value End If End If End If End If End If 'End Of Gui Movement control>! ```With the above code, you will want to change 828 to the width of your game screen. If you arent sure then just mess around with the number till it matches your screen.>! You also need to change the 418 to the height of your game screen.>! Also it is worth noting, that you do not need to ever set MoveCheck to false because the mousemove function checks if the mouse is held down and then if not it will release anyway, any time you click to move something it will recheck if MoveCheck should be true or false. Part 3\. The last part is to make sure that if you move the frame really fast, it doesnt accidently think you were trying to look at the spell/item description.PART THREE fix starts here>! Change this: With frmMain .picSpellDesc.top = y .picSpellDesc.Left = x .picSpellDesc.Visible = True>! to this>! ``` With frmMain .picSpellDesc.top = y .picSpellDesc.Left = x If MoveCheck = False Then 'if not movin the gui then show the descriptions .picSpellDesc.Visible = True End If>! ```>! and for the item descriptions change this: With frmMain .picItemDesc.top = y .picItemDesc.Left = x .picItemDesc.Visible = True>! to this>! ``` With frmMain .picItemDesc.top = y .picItemDesc.Left = x>! If MoveCheck = False Then 'if not movin the gui then show the descriptions .picItemDesc.Visible = True End If>! ```UPDATED - Part 4\. New fix that i found, when you equip an item it doesnt update your stats until you reopen the character windowPART FOUR fix starts hereFind this code:```Sub HandlePlayerWornEq(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() Call SetPlayerEquipment(MyIndex, Buffer.ReadLong, Armor) Call SetPlayerEquipment(MyIndex, Buffer.ReadLong, Weapon) Call SetPlayerEquipment(MyIndex, Buffer.ReadLong, Helmet) Call SetPlayerEquipment(MyIndex, Buffer.ReadLong, Shield)```and add this under it 'UPDATE STATS ETC SendRequestPlayerDataSorry if the tutorial/fix is sloppy, im not really a tutorial person but thought id give it a shot.Also sorry if the descriptions of the bugs dont match correctly to the code related to them, I wrote this tutorial after having fixed all the bugs and may not have matched some of the code to the right bug.Hopefully I helped some of you, if you used the tutorial by Sekaru please credit him.If you used this fix please credit me. 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