tehl33tjim Posted March 28, 2013 Author Share Posted March 28, 2013 I get a Runtime Error 380, and it highlights this in ModGameEditors:```frmEditor_Item.chkPierce.Value = .Armor```I have that declared in ModTypes, under the ItemRec as a Boolean on both the client and the server.This happens when I am in game when I access the item editor for the one item that I had checked (true'd) the chkbox for.And the code for that chkbox is as follows:```Private Sub chkPierce_Click()' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerIf chkPierce.Value = 0 Then chkPierce.Caption = "Pierce: No"ElseIf chkPierce.Value = 1 Then chkPierce.Caption = "Pierce: Yes"End IfItem(EditorIndex).Armor = chkPierce.Valueerrorhandler:HandleError "chkPierce_Click", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```Although I can't see that being the problem - it does only happen when this chkbox and it's _Click code is present on the form. What am I missing? Link to comment Share on other sites More sharing options...
kris_hole Posted March 28, 2013 Share Posted March 28, 2013 I was under the impression that check boxes were those weird components in vb6 where you used .checked (true/false) rather than value because value didn't actually work right… Link to comment Share on other sites More sharing options...
tehl33tjim Posted March 28, 2013 Author Share Posted March 28, 2013 Should I just swap out the chkbox for a scrlbar? .Min = 0 and .Max=1? That should still work with a boolean, right? Link to comment Share on other sites More sharing options...
abhi2011 Posted March 28, 2013 Share Posted March 28, 2013 > Should I just swap out the chkbox for a scrlbar? .Min = 0 and .Max=1? That should still work with a boolean, right?Yea that will work.Checkboxes have 3 values. 0 = grayed, 1 = unchecked, 2 = checked. So setting a value of greater than 1 to a boolean value will generate an error. You can use a select case and check if the value of the checkbox is 1 or 2 and subtract the value with 1 and save it as a boolean (since false = 0 and true = 1) Or you can just change the boolean to a byte and the rest will be done for you. Link to comment Share on other sites More sharing options...
Matt Posted March 28, 2013 Share Posted March 28, 2013 > Checkboxes have 3 values. 0 = grayed, 1 = unchecked, 2 = checked.0 = unchecked/false1 = checked/true2 = grayedAnyways, the issue lies with the .Armor value because the checkbox can only contain 0 or 1\. If you try to assign the checkbox's value to anything less than that or higher than that, it will bring up a RTE 380\. When the RTE comes up, hover your mouse over .Armor and you'll see the value being assigned to the checkbox. Link to comment Share on other sites More sharing options...
tehl33tjim Posted March 28, 2013 Author Share Posted March 28, 2013 > Yea that will work.> > Checkboxes have 3 values. 0 = grayed, 1 = unchecked, 2 = checked. So setting a value of greater than 1 to a boolean value will generate an error. You can use a select case and check if the value of the checkbox is 1 or 2 and subtract the value with 1 and save it as a boolean (since false = 0 and true = 1) Or you can just change the boolean to a byte and the rest will be done for you.I thought that grayed=2\. So that's why. Gonna try it out in a bit.Well wait, that can't be. Because I did the same thing for NpcRec, added as a Boolean. I did everything the same, and there are no errors for that…hmmm.... Link to comment Share on other sites More sharing options...
abhi2011 Posted March 29, 2013 Share Posted March 29, 2013 > 0 = unchecked/false> > 1 = checked/true> > 2 = grayedthanks. I knew mine was wrong. Link to comment Share on other sites More sharing options...
tehl33tjim Posted March 30, 2013 Author Share Posted March 30, 2013 See, if 0 = unchecked/false, and 1 = checked/true, there shouldn't be any error, right? The checkbox value is never set to 2/grayed by the user.This also only happened AFTER I had checked an item with the .armor (piercing) attribute. After that, upon selecting it from the list it gives me the error. I can still select and view the info/change the info for all other items. I can even change the state of the checkbox. But if it is checked, and I go back to check it, I get the 380.I wonder if order I place the code in, under the ModGameEditor module, is the issue? Link to comment Share on other sites More sharing options...
Matt Posted March 31, 2013 Share Posted March 31, 2013 When the RTE comes up, hover your mouse over .Armor and you'll see the value being assigned to the checkbox. Post that number here.ORYou could send me your source, and I'll (try) to fix it for you. You have my word that I won't steal anything you send. ![^_^](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/happy.png) Link to comment Share on other sites More sharing options...
tehl33tjim Posted April 1, 2013 Author Share Posted April 1, 2013 I have since changed the Pierce and Armor variables to Long, and now to Byte. My Armor works on NPCs, not errors at all. But my variables for Pierce always give me an error. Now I get one constantly.I get error 380:```frmEditor_Item.scrlPierce.Value = .Pierce```is highlighted within ModGameEditorsMouseover the first half gives me:```frmEditor_Item.scrlPierce.Value = 0```Mouseover .Pierce gives me:```.Pierce = 255```When it was a Long variable, it gave me an overflow with .Pierce = 66555 or whichever specific number it was. So what is causing this to happen? I now have a scrlPierce, min = 0, max = 1```Private Sub scrlPierce_Change() ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler If EditorIndex = 0 Or EditorIndex > MAX_ITEMS Then Exit Sub If scrlPierce.Value = 0 Then lblPierce.Caption = "Pierce: No" ElseIf scrlPierce.Value = 1 Then lblPierce.Caption = "Pierce: Yes" End If Item(EditorIndex).Pierce = scrlPierce.Value ' Error handler Exit Suberrorhandler: HandleError "scrlPierce_Change", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```Anything look suspicious to anyone? Link to comment Share on other sites More sharing options...
Matt Posted April 1, 2013 Share Posted April 1, 2013 > When it was a Long variable, it gave me an overflow with .Pierce = 66555 or whichever specific number it was. So what is causing this to happen? I now have a scrlPierce, min = 0, max = 1If the max is 1, then of course an overflow RTE comes up.As I previously mentioned, and if you want, send me your source and I'll fix it for you. Link to comment Share on other sites More sharing options...
tehl33tjim Posted April 2, 2013 Author Share Posted April 2, 2013 But that makes no sense, because I have another scrlbar for NPC's Armor, and that works perfectly with the max value set to 1.And I'd like to learn this stuff myself, instead of having somebody do it for me. Link to comment Share on other sites More sharing options...
Matt Posted April 2, 2013 Share Posted April 2, 2013 Do you have teamviewer? I could help you out on that. Link to comment Share on other sites More sharing options...
tehl33tjim Posted April 3, 2013 Author Share Posted April 3, 2013 No I don't, and at the moment have no interest in it. I appreciate the help, but I'd rather not somebody else just fix my code. I want to learn why it's acting the way it is, otherwise I won't get any better.I just want to know why that variable keeps getting flooded as it is. There has to be some reason. The NPC version has an almost identical structure (sans replacing Item with NPC), and it works perfectly. It can't be that the scroll-bar's maximum value is set to 1, why would that overflow the variable? That doesn't make sense - mostly because it should only go up to 1 - but also because I have another scroll-bar with a maximum value set to 1, and that works.[Edit]I figured it out. Everything is working now, and I'm pretty sure I understand why too.[/edit] Link to comment Share on other sites More sharing options...
Matt Posted April 3, 2013 Share Posted April 3, 2013 > I want to learn why it's acting the way it is, otherwise I won't get any better.I'm glad you want to learn!Its easier for me to figure out what's going wrong when I have the source in VB6\. You wouldn't be figuring it out on your own if we told you why its being flooded, and pointing that out on TeamViewer isn't any different. Regardless, I'm glad you fixed it. 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