sweetboy Posted October 18, 2013 Author Share Posted October 18, 2013 uhm sorry if im asking too much, i got an error again at this lineFunction GetPlayerExp(ByVal index As Long) As Long GetPlayerExp = Player(index).EXPEnd Functionthen another error atGetWeapon = GetPlayerEquipment(attacker, weapon)im using eclipse Final Frontier thanks >.< Link to comment Share on other sites More sharing options...
Guest Posted October 18, 2013 Share Posted October 18, 2013 overflow means that you are trying to fit data into something that it can not fit into. hence overflowing data.This means that Player(index).EXP is Larger or smaller than GetPlayerExp so it throws this error.Same for the other one GetWeapon is smaller or just can hold a big negative value that GetPlayerEquipment can. Just make sure the data types match up and that you are not trying to Go over the size limit the data type is.Byte = 0 to 255Integer = -32,768 to 32,767Long = -2,147,483,648 to 2,147,483,647 Link to comment Share on other sites More sharing options...
sweetboy Posted October 19, 2013 Author Share Posted October 19, 2013 at which mod to see the value? Link to comment Share on other sites More sharing options...
RyokuHasu Posted October 19, 2013 Share Posted October 19, 2013 A good way to help solve this is to educate yourself on basic programming principles and why certain things work and certain things break.Google or YouTube VB6 learning tutorials and that should get you started on the right path. This might seem like a lot or even hard, but it's well worth it to learn to fix some problems on your own rather than being spoon fed everything, trust me. :DIf you can learn the basics it will go a long way for helping you make games and you'll find yourself asking stuff in the Q&A section less and less.But to help solve your current problem: Hold your mouse over every part of the yellowed line slowly moving it over until it shows exactly what part is broken. This way it lets you see exactly what all the values are for each variable. Link to comment Share on other sites More sharing options...
sweetboy Posted November 27, 2013 Author Share Posted November 27, 2013 bump >.< still don't know how to fix this Link to comment Share on other sites More sharing options...
Matt Posted November 27, 2013 Share Posted November 27, 2013 As explained earlier, an overflow runtime error simply means that you're trying to assign a value to a variable that it can't contain. When the error pops up, hover over all the variables and give me their values. Link to comment Share on other sites More sharing options...
sweetboy Posted November 27, 2013 Author Share Posted November 27, 2013 at which mods bro? :D Link to comment Share on other sites More sharing options...
Matt Posted November 27, 2013 Share Posted November 27, 2013 What?.. What do you mean by "mods"? Link to comment Share on other sites More sharing options...
sweetboy Posted November 27, 2013 Author Share Posted November 27, 2013 hover over all the variables and give me their values..> Link to comment Share on other sites More sharing options...
Matt Posted November 27, 2013 Share Posted November 27, 2013 All relevant variables. Tell me what the values are. Link to comment Share on other sites More sharing options...
sweetboy Posted November 27, 2013 Author Share Posted November 27, 2013 i got thisPublic Sub GivePlayerEXP(ByVal index As Long, ByVal EXP As Long) ' give the exp Call SetPlayerExp(index, GetPlayerExp(index) + EXP) SendEXP index SendActionMsg GetPlayerMap(index), "+" & EXP & " EXP", White, 1, (GetPlayerX(index) * 32), (GetPlayerY(index) * 32) ' check if we've leveled CheckPlayerLevelUp indexEnd SubSub SendEXP(ByVal index As Long)Dim buffer As clsBuffer Set buffer = New clsBuffer buffer.WriteLong SPlayerEXP buffer.WriteLong GetPlayerExp(index) buffer.WriteLong GetPlayerNextLevel(index) SendDataTo index, buffer.ToArray() Set buffer = NothingEnd SubSub CheckPlayerLevelUp(ByVal index As Long) Dim i As Long Dim expRollover As Long Dim level_count As Long level_count = 0 Do While GetPlayerExp(index) >= GetPlayerNextLevel(index) expRollover = GetPlayerExp(index) - GetPlayerNextLevel(index) ' can level up? If Not SetPlayerLevel(index, GetPlayerLevel(index) + 1) Then Exit Sub End If Call SetPlayerPOINTS(index, GetPlayerPOINTS(index) + 3) Call SetPlayerExp(index, expRollover) level_count = level_count + 1 Loop If level_count > 0 Then If level_count = 1 Then 'singular GlobalMsg GetPlayerName(index) & " has gained " & level_count & " level!", Brown Else 'plural GlobalMsg GetPlayerName(index) & " has gained " & level_count & " levels!", Brown End If SendEXP index SendPlayerData index SendPlayerSound index, GetPlayerX(index), GetPlayerY(index), SoundEntity.seLevelUp, 1 End IfEnd SubPublic Sub KillPlayer(ByVal index As Long)Dim EXP As Long ' Calculate exp to give attacker EXP = GetPlayerExp(index) \ 5 ' Make sure we dont get less then 0 If EXP < 0 Then EXP = 0 If EXP = 0 Then Call PlayerMsg(index, "You lost no exp.", BrightRed) Else Call SetPlayerExp(index, GetPlayerExp(index) - EXP) SendEXP index Call PlayerMsg(index, "You lost " & EXP & " exp.", BrightRed) End If Call OnDeath(index)End SubSub SetPlayerExp(ByVal index As Long, ByVal EXP As Long) Player(index).EXP = EXP If GetPlayerLevel(index) = MAX_LEVELS And Player(index).EXP > GetPlayerNextLevel(index) Then Player(index).EXP = GetPlayerNextLevel(index) End IfEnd Sub Link to comment Share on other sites More sharing options...
sweetboy Posted November 28, 2013 Author Share Posted November 28, 2013 bump >.< Link to comment Share on other sites More sharing options...
PD Posted November 28, 2013 Share Posted November 28, 2013 Please go learn the basics of Visual Basic 6. Link to comment Share on other sites More sharing options...
Matt Posted November 28, 2013 Share Posted November 28, 2013 I don't think you understand. Run your game in debug mode, and when the error pops up, hover over any variable that's in the sub or function. Tell me what the value is. Link to comment Share on other sites More sharing options...
Richy420Rich Posted November 28, 2013 Share Posted November 28, 2013 For GetPlayerExp, it's trying to read a value that can not fit into its variable type.You'll need to find the value that you're trying to grab and change it, because that is what's causing the error.GetWeapon = GetPlayerEquipment(attacker, weapon)This error may happen if there is no weapon equipped, so you need to run a check to see if the weapon is even equipped before you can call it.Also make sure that (attacker) is being used in the above sub list of variables, otherwise it should be (index)If GetPlayerEquipment(attacker, weapon) > 0 Then GetWeapon = GetPlayerEquipment(attacker, weapon) Link to comment Share on other sites More sharing options...
sweetboy Posted November 29, 2013 Author Share Posted November 29, 2013 okay here is the line when its error[http://prntscr.com/27g6ps](http://prntscr.com/27g6ps)and um guys i don't know where its value T.T Link to comment Share on other sites More sharing options...
sweetboy Posted November 29, 2013 Author Share Posted November 29, 2013 GetWeapon = GetPlayerEquipment(attacker, weapon)ah i manage to solve this one the engine put the GetWeapon As Byte i change it to As Longthe left problem left isFunction GetPlayerExp(ByVal index As Long) As Long GetPlayerExp = Player(index).EXPEnd Function Link to comment Share on other sites More sharing options...
Matt Posted November 29, 2013 Share Posted November 29, 2013 Hover over "index" when the error comes up, and you'll see the value. Link to comment Share on other sites More sharing options...
sweetboy Posted November 30, 2013 Author Share Posted November 30, 2013 [http://prntscr.com/27mhrd](http://prntscr.com/27mhrd)this bro? :D Link to comment Share on other sites More sharing options...
Richy420Rich Posted November 30, 2013 Share Posted November 30, 2013 Yeah, a temp fix is to add this before that line;If index <= 0 And index > MAX_PLAYERS Then Exit FunctionJust until you can figure out why index is 0\. This above code will just exit out of the function if the index is not an actual player on the server. Link to comment Share on other sites More sharing options...
sweetboy Posted November 30, 2013 Author Share Posted November 30, 2013 okay i will try it :D thanks richy 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