[KoZ]MatthewPe2 Posted July 5, 2005 Could you please add this to frmThings?Private Sub txtThing_Change() Dim Cat As String Dim a As Long 'Erase thing preview Set imgThing.Picture = Nothing 'Select current thing type If (txtThing.Text <> "") Then 'Do not give an error when the item cant be found On Local Error Resume Next trvThings.SelectedItem.selected = False trvThings.nodes("T" & txtThing.Text).selected = True trvThings.nodes("T" & txtThing.Text).EnsureVisible lstThings.SelectedItem.selected = False lstThings.ListItems("T" & txtThing.Text).selected = True lstThings.ListItems("T" & txtThing.Text).EnsureVisible On Local Error GoTo 0 'Check if a thing type is given If (Trim$(txtThing.Text) <> "") Then 'Show thing preview if possible GetScaledSpritePicture Val(txtThing.Text), imgThing, picThing.ScaleWidth, picThing.ScaleHeight, False 'Find its category Cat = GetThingTypeCategory(Val(txtThing.Text)) 'Check if in any category If (Trim$(Cat) <> "") Then 'The Bug Fix I Made If (mapconfig("thingtypes")(Cat).Exists(txtThing.Text) = False) Then Exit Sub End If 'Check if the thing has any arguments If mapconfig("thingtypes")(Cat)(txtThing.Text).Exists("arg1") Or _ mapconfig("thingtypes")(Cat)(txtThing.Text).Exists("arg2") Or _ mapconfig("thingtypes")(Cat)(txtThing.Text).Exists("arg3") Or _ mapconfig("thingtypes")(Cat)(txtThing.Text).Exists("arg4") Or _ mapconfig("thingtypes")(Cat)(txtThing.Text).Exists("arg5") Then 'Disable thing effect txtType.Enabled = False lblEffect.ForeColor = vbGrayText cmdSelectType.Enabled = False 'Set all arguments For a = 0 To 4 'Check if argument is defined If (mapconfig("thingtypes")(Cat)(txtThing.Text).Exists("arg" & a + 1)) Then 'Set argument lblArgument(a).Caption = mapconfig("thingtypes")(Cat)(txtThing.Text)("arg" & a + 1) & ":" lblArgument(a).ForeColor = vbButtonText 'txtArgument(a).Enabled = True Else 'Disable argument lblArgument(a).Caption = "Argument " & a + 1 & ":" lblArgument(a).ForeColor = vbGrayText 'txtArgument(a).Enabled = False End If Next a Else 'Enable thing effect txtType.Enabled = True lblEffect.ForeColor = vbButtonText cmdSelectType.Enabled = True 'Let the arguments be set by effect txtType_Change End If 'Show thing properties lblThingWidth.Caption = GetThingWidth(Val(txtThing.Text)) lblThingHeight.Caption = GetThingHeight(Val(txtThing.Text)) lblThingHangs.Caption = YesNo(GetThingHangs(Val(txtThing.Text))) lblThingBlocks.Caption = GetThingBlockingDesc(GetThingBlocking(Val(txtThing.Text))) Else 'Enable thing effect txtType.Enabled = True lblEffect.ForeColor = vbButtonText cmdSelectType.Enabled = True 'No clue about its properties lblThingWidth.Caption = "?" lblThingHeight.Caption = "?" lblThingHangs.Caption = "?" lblThingBlocks.Caption = "?" 'Let the arguments be set by effect txtType_Change End If End If End If End Sub it fixes the error when you type an invalid number like: 1- 0 Share this post Link to post
CodeImp Posted July 5, 2005 I dont know what you changed in there, but I believe I already fixed that error for next version (see changelog). Thanks anyway ;) 0 Share this post Link to post
[KoZ]MatthewPe2 Posted July 5, 2005 this is the bit 'The Bug Fix I Made If (mapconfig("thingtypes")(Cat).Exists(txtThing.Text) = False) Then Exit Sub End If the changelog hadn't had it because it was a rare but annoying 0 Share this post Link to post
CodeImp Posted July 5, 2005 Changelog said: Fixed crash when giving an odd input in thing type number. 0 Share this post Link to post