Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Variable always reset to 0


cacadosman
 Share

Recommended Posts

> i set the variable to 5
>
> but, the var is always reset to 0
>
> sorry for bad english ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png)

Check to see if its being saved properly, and if its loading properly. Go into VB6, and click twice on the object where you save the variable's value. Paste the sub of code here. Then, there should be a sub called something along the lines of "EventEditorInit". Post that entire sub here.
Link to comment
Share on other sites

okay, here the code ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) (frmEditor_Events)

```

Option Explicit

Private ListIndex As Long

Private Sub cmbBranchClass_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = cmbBranchClass.ListIndex + 1

End Sub

Private Sub cmbBranchItem_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = cmbBranchItem.ListIndex + 1

End Sub

Private Sub cmbBranchSkill_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = cmbBranchSkill.ListIndex + 1

End Sub

Private Sub cmbBranchSwitch_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(5) = cmbBranchSwitch.ListIndex

End Sub

Private Sub cmbBranchSwitchReq_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = cmbBranchSwitchReq.ListIndex

End Sub

Private Sub cmbBranchVar_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(6) = cmbBranchVar.ListIndex

End Sub

Private Sub cmbEffectType_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

fraSetFog.visible = False

fraSetWeather.visible = False

fraMapOverlay.visible = False

Select Case cmbEffectType.ListIndex

Case 3: fraSetFog.visible = True

Case 4: fraSetWeather.visible = True

Case 5: fraMapOverlay.visible = True

End Select

Events(EditorIndex).SubEvents(ListIndex).data(1) = cmbEffectType.ListIndex

End Sub

Private Sub cmbHasItem_Click()

If EditorIndex = 0 Then Exit Sub

Events(EditorIndex).HasItemIndex = cmbHasItem.ListIndex + 1

End Sub

Private Sub cmbChangeClass_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(1) = cmbChangeClass.ListIndex + 1

End Sub

Private Sub cmbChangeSkills_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(1) = cmbChangeSkills.ListIndex + 1

End Sub

Private Sub cmbChatBubbleTarget_click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = cmbChatBubbleTarget.ListIndex + 1

End Sub

Private Sub cmbLabel_Ok_Click()

fraLabeling.visible = False

SendSwitchesAndVariables

End Sub

Private Sub cmbLevelReqOperator_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(5) = cmbLevelReqOperator.ListIndex

End Sub

Private Sub cmbPlayBGM_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).Text(1) = Trim$(musicCache(cmbPlayBGM.ListIndex + 1))

End Sub

Private Sub cmbPlayerSwitch_Click()

If EditorIndex = 0 Then Exit Sub

Events(EditorIndex).SwitchIndex = cmbPlayerSwitch.ListIndex

End Sub

Private Sub cmbPlayerSwitchCompare_Click()

If EditorIndex = 0 Then Exit Sub

Events(EditorIndex).SwitchCompare = cmbPlayerSwitchCompare.ListIndex

End Sub

Private Sub cmbPlayerSwitchSet_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = cmbPlayerSwitchSet.ListIndex

End Sub

Private Sub cmbPlayerVar_Click()

If EditorIndex = 0 Then Exit Sub

Events(EditorIndex).VariableIndex = cmbPlayerVar.ListIndex

End Sub

Private Sub cmbPlayerVarCompare_Click()

If EditorIndex = 0 Then Exit Sub

Events(EditorIndex).VariableCompare = cmbPlayerVarCompare.ListIndex

End Sub

Private Sub cmbPlaySound_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).Text(1) = Trim$(soundCache(cmbPlaySound.ListIndex + 1))

End Sub

Private Sub cmbSetAccess_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(1) = cmbSetAccess.ListIndex

End Sub

Private Sub cmbSpawnNPC_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(1) = cmbSpawnNPC.ListIndex + 1

End Sub

Private Sub cmbSwitch_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(1) = cmbSwitch.ListIndex

End Sub

Private Sub cmbTrigger_Click()

If EditorIndex = 0 Then Exit Sub

Events(EditorIndex).Trigger = cmbTrigger.ListIndex

End Sub

Private Sub cmbVariable_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(1) = cmbVariable.ListIndex

End Sub

Private Sub cmbVarReqOperator_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(5) = cmbVarReqOperator.ListIndex

End Sub

Private Sub CmbWeather_click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = CmbWeather.ListIndex

End Sub

Private Sub cmdAddMenuOption_Click()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Dim optIdx As Long

With Events(EditorIndex).SubEvents(ListIndex)

ReDim Preserve .data(1 To UBound(.data) + 1)

ReDim Preserve .Text(1 To UBound(.data) + 1)

.data(UBound(.data)) = 1

End With

lstMenuOptions.AddItem ": " & 1

End Sub

Private Sub cmdAddOk_Click()

fraCommands.visible = False

End Sub

Private Sub cmdCommand_Click(Index As Integer)

Dim count As Long

If Not (Events(EditorIndex).HasSubEvents) Then

ReDim Events(EditorIndex).SubEvents(1 To 1)

Events(EditorIndex).HasSubEvents = True

Else

count = UBound(Events(EditorIndex).SubEvents) + 1

ReDim Preserve Events(EditorIndex).SubEvents(1 To count)

End If

Call Events_SetSubEventType(EditorIndex, UBound(Events(EditorIndex).SubEvents), Index)

Call PopulateSubEventList

fraCommands.visible = False

End Sub

Private Sub cmdDelete_Click()

Dim tmpIndex As Long

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If EditorIndex <= 0 Or EditorIndex > MAX_EVENTS Then Exit Sub

ListIndex = 0

ClearEvent EditorIndex

tmpIndex = lstIndex.ListIndex

lstIndex.RemoveItem EditorIndex - 1

lstIndex.AddItem EditorIndex & ": " & Trim$(Events(EditorIndex).name), EditorIndex - 1

lstIndex.ListIndex = tmpIndex

Event_Changed(EditorIndex) = True

EventEditorInit

' Error handler

Exit Sub

errorhandler:

HandleError "cmdDelete_Click", "frmEditor_Events", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Private Sub cmdEditOk_Click()

Call PopulateSubEventList

fraEditCommand.visible = False

End Sub

Private Sub cmdLabel_Cancel_Click()

fraLabeling.visible = False

RequestSwitchesAndVariables

End Sub

Private Sub cmdModifyMenuOption_Click()

Dim tempIndex As Long, optIdx As Long

tempIndex = lstSubEvents.ListIndex + 1

optIdx = lstMenuOptions.ListIndex + 1

If optIdx < 1 Or optIdx > UBound(Events(EditorIndex).SubEvents(ListIndex).data) Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).Text(optIdx + 1) = Trim$(txtMenuOptText.Text)

Events(EditorIndex).SubEvents(ListIndex).data(optIdx) = scrlMenuOptDest.value

lstMenuOptions.List(optIdx - 1) = Trim$(txtMenuOptText.Text) & ": " & scrlMenuOptDest.value

End Sub

Private Sub cmdRemoveMenuOption_Click()

Dim Index As Long, i As Long

Index = lstMenuOptions.ListIndex + 1

If Index > 0 And Index < lstMenuOptions.ListCount And lstMenuOptions.ListCount > 0 Then

For i = Index + 1 To lstMenuOptions.ListCount

Events(EditorIndex).SubEvents(ListIndex).data(i - 1) = Events(EditorIndex).SubEvents(ListIndex).data(i)

Events(EditorIndex).SubEvents(ListIndex).Text(i) = Events(EditorIndex).SubEvents(ListIndex).Text(i + 1)

Next i

ReDim Preserve Events(EditorIndex).SubEvents(ListIndex).data(1 To UBound(Events(EditorIndex).SubEvents(ListIndex).data) - 1)

ReDim Preserve Events(EditorIndex).SubEvents(ListIndex).Text(1 To UBound(Events(EditorIndex).SubEvents(ListIndex).Text) - 1)

Call PopulateSubEventConfig

End If

End Sub

Private Sub cmdRename_Cancel_Click()

Dim i As Long

fraRenaming.visible = False

RenameType = 0

RenameIndex = 0

lstSwitches.Clear

For i = 1 To MAX_SWITCHES

lstSwitches.AddItem CStr(i) & ". " & Trim$(Switches(i))

Next

lstSwitches.ListIndex = 0

lstVariables.Clear

For i = 1 To MAX_VARIABLES

lstVariables.AddItem CStr(i) & ". " & Trim$(Variables(i))

Next

lstVariables.ListIndex = 0

End Sub

Private Sub cmdRename_Ok_Click()

Dim i As Long

Select Case RenameType

Case 1

'Variable

If RenameIndex > 0 And RenameIndex <= MAX_VARIABLES + 1 Then

Variables(RenameIndex) = txtRename.Text

fraRenaming.visible = False

RenameType = 0

RenameIndex = 0

End If

Case 2

'Switch

If RenameIndex > 0 And RenameIndex <= MAX_SWITCHES + 1 Then

Switches(RenameIndex) = txtRename.Text

fraRenaming.visible = False

RenameType = 0

RenameIndex = 0

End If

End Select

lstSwitches.Clear

For i = 1 To MAX_SWITCHES

lstSwitches.AddItem CStr(i) & ". " & Trim$(Switches(i))

Next

lstSwitches.ListIndex = 0

lstVariables.Clear

For i = 1 To MAX_VARIABLES

lstVariables.AddItem CStr(i) & ". " & Trim$(Variables(i))

Next

lstVariables.ListIndex = 0

End Sub

Private Sub cmdRenameSwitch_Click()

If lstSwitches.ListIndex > -1 And lstSwitches.ListIndex < MAX_SWITCHES Then

fraRenaming.visible = True

lblEditing.Caption = "Editing Switch #" & CStr(lstSwitches.ListIndex + 1)

txtRename.Text = Switches(lstSwitches.ListIndex + 1)

RenameType = 2

RenameIndex = lstSwitches.ListIndex + 1

End If

End Sub

Private Sub cmdRenameVariable_Click()

If lstVariables.ListIndex > -1 And lstVariables.ListIndex < MAX_VARIABLES Then

fraRenaming.visible = True

lblEditing.Caption = "Editing Variable #" & CStr(lstVariables.ListIndex + 1)

txtRename.Text = Variables(lstVariables.ListIndex + 1)

RenameType = 1

RenameIndex = lstVariables.ListIndex + 1

End If

End Sub

Private Sub cmdSave_Click()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Call EventEditorOk

ListIndex = 0

' Error handler

Exit Sub

errorhandler:

HandleError "cmdSave_Click", "frmEditor_Events", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Private Sub cmdCancel_Click()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Call EventEditorCancel

ListIndex = 0

' Error handler

Exit Sub

errorhandler:

HandleError "cmdCancel_Click", "frmEditor_Events", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Private Sub cmdSubEventAdd_Click()

fraCommands.visible = True

End Sub

Private Sub cmdSubEventDown_Click()

Dim Index As Long

Index = lstSubEvents.ListIndex + 1

If Index > 0 And Index < lstSubEvents.ListCount Then

Dim temp As SubEventRec

temp = Events(EditorIndex).SubEvents(Index)

Events(EditorIndex).SubEvents(Index) = Events(EditorIndex).SubEvents(Index + 1)

Events(EditorIndex).SubEvents(Index + 1) = temp

Call PopulateSubEventList

End If

End Sub

Private Sub cmdSubEventEdit_Click()

If ListIndex > 0 And ListIndex <= lstSubEvents.ListCount Then

fraEditCommand.visible = True

PopulateSubEventConfig

End If

End Sub

Private Sub cmdSubEventRemove_Click()

Dim Index As Long, i As Long

If ListIndex > 0 And ListIndex <= lstSubEvents.ListCount Then

For i = ListIndex + 1 To lstSubEvents.ListCount

Events(EditorIndex).SubEvents(i - 1) = Events(EditorIndex).SubEvents(i)

Next i

If lstSubEvents.ListCount = 1 Then

Events(EditorIndex).HasSubEvents = False

Erase Events(EditorIndex).SubEvents

Else

ReDim Preserve Events(EditorIndex).SubEvents(1 To lstSubEvents.ListCount - 1)

End If

Call PopulateSubEventList

End If

End Sub

Private Sub cmdSubEventUp_Click()

Dim Index As Long

Index = lstSubEvents.ListIndex + 1

If Index > 1 And Index <= lstSubEvents.ListCount Then

Dim temp As SubEventRec

temp = Events(EditorIndex).SubEvents(Index)

Events(EditorIndex).SubEvents(Index) = Events(EditorIndex).SubEvents(Index - 1)

Events(EditorIndex).SubEvents(Index - 1) = temp

Call PopulateSubEventList

End If

End Sub

Private Sub cmdSwitchesVariables_Click()

Dim i As Long

fraLabeling.visible = True

lstSwitches.Clear

For i = 1 To MAX_SWITCHES

lstSwitches.AddItem CStr(i) & ". " & Trim$(Switches(i))

Next

lstSwitches.ListIndex = 0

lstVariables.Clear

For i = 1 To MAX_VARIABLES

lstVariables.AddItem CStr(i) & ". " & Trim$(Variables(i))

Next

lstVariables.ListIndex = 0

End Sub

Private Sub Form_Load()

Dim i As Long, cap As Long

'Move windows to right places

frmEditor_Events.Width = 9600

frmEditor_Events.Height = 8835

fraEditCommand.Left = 232

fraEditCommand.Top = 152

fraCommands.Left = 232

fraCommands.Top = 152

fraLabeling.Width = 609

fraLabeling.Height = 513

ListIndex = 0

scrlOpenShop.max = MAX_SHOPS

scrlGiveItemID.max = MAX_ITEMS

scrlPlayAnimationAnim.max = MAX_ANIMATIONS

scrlWarpMap.max = MAX_MAPS

scrlMessageSprite.max = NumCharacters

ScrlFogData(0).max = NumFogs

cmbLevelReqOperator.Clear

cmbPlayerVarCompare.Clear

cmbVarReqOperator.Clear

For i = 0 To ComparisonOperator_Count - 1

cmbLevelReqOperator.AddItem GetComparisonOperatorName(i)

cmbPlayerVarCompare.AddItem GetComparisonOperatorName(i)

cmbVarReqOperator.AddItem GetComparisonOperatorName(i)

Next

cmbHasItem.Clear

cmbBranchItem.Clear

For i = 1 To MAX_ITEMS

cmbHasItem.AddItem Trim$(Item(i).name)

cmbBranchItem.AddItem Trim$(Item(i).name)

Next

cmbSwitch.Clear

cmbPlayerSwitch.Clear

cmbBranchSwitch.Clear

For i = 1 To MAX_SWITCHES

cmbSwitch.AddItem i & ". " & Switches(i)

cmbPlayerSwitch.AddItem i & ". " & Switches(i)

cmbBranchSwitch.AddItem i & ". " & Switches(i)

Next

cmbVariable.Clear

cmbPlayerVar.Clear

cmbBranchVar.Clear

For i = 1 To MAX_VARIABLES

cmbVariable.AddItem i & ". " & Variables(i)

cmbPlayerVar.AddItem i & ". " & Variables(i)

cmbBranchVar.AddItem i & ". " & Variables(i)

Next

cmbBranchClass.Clear

cmbChangeClass.Clear

For i = 1 To Max_Classes

cmbBranchClass.AddItem Trim$(Class(i).name)

cmbChangeClass.AddItem Trim$(Class(i).name)

Next

cmbBranchSkill.Clear

cmbChangeSkills.Clear

For i = 1 To MAX_SPELLS

cmbBranchClass.AddItem Trim$(Spell(i).name)

cmbChangeSkills.AddItem Trim$(Spell(i).name)

Next

cmbChatBubbleTarget.Clear

cmbSpawnNPC.Clear

For i = 1 To MAX_MAP_NPCS

If Map.Npc(i) <= 0 Then

cmbChatBubbleTarget.AddItem CStr(i) & ". "

cmbSpawnNPC.AddItem CStr(i) & ". "

Else

cmbChatBubbleTarget.AddItem CStr(i) & ". " & Trim$(Npc(Map.Npc(i)).name)

cmbSpawnNPC.AddItem CStr(i) & ". " & Trim$(Npc(Map.Npc(i)).name)

End If

Next

cmbPlaySound.Clear

For i = 1 To UBound(soundCache)

cmbPlaySound.AddItem (soundCache(i))

cmbPlayBGM.AddItem (soundCache(i))

Next

cmbPlayBGM.Clear

For i = 1 To UBound(musicCache)

cmbPlayBGM.AddItem (musicCache(i))

Next

End Sub

Private Sub chkHasItem_Click()

If chkHasItem.value = 0 Then cmbHasItem.Enabled = False Else cmbHasItem.Enabled = True

Events(EditorIndex).chkHasItem = chkHasItem.value

End Sub

Private Sub chkPlayerSwitch_Click()

If chkPlayerSwitch.value = 0 Then

cmbPlayerSwitch.Enabled = False

cmbPlayerSwitchCompare.Enabled = False

Else

cmbPlayerSwitch.Enabled = True

cmbPlayerSwitchCompare.Enabled = True

End If

Events(EditorIndex).chkSwitch = chkPlayerSwitch.value

End Sub

Private Sub chkPlayerVar_Click()

If chkPlayerVar.value = 0 Then

cmbPlayerVar.Enabled = False

txtPlayerVariable.Enabled = False

cmbPlayerVarCompare.Enabled = False

Else

cmbPlayerVar.Enabled = True

txtPlayerVariable.Enabled = True

cmbPlayerVarCompare.Enabled = True

End If

Events(EditorIndex).chkVariable = chkPlayerVar.value

End Sub

Private Sub chkWalkthrought_Click()

If EditorIndex = 0 Then Exit Sub

Events(EditorIndex).WalkThrought = chkWalkthrought.value

End Sub

Private Sub fraChangeVariable_DragDrop(Source As Control, X As Single, Y As Single)

End Sub

Private Sub fraEditCommand_DragDrop(Source As Control, X As Single, Y As Single)

End Sub

Private Sub lstIndex_Click()

EventEditorInit

End Sub

Private Sub lstMenuOptions_Click()

Dim tempIndex As Long, optIdx As Long

tempIndex = lstSubEvents.ListIndex + 1

optIdx = lstMenuOptions.ListIndex + 1

If optIdx < 1 Or optIdx > UBound(Events(EditorIndex).SubEvents(ListIndex).data) Then Exit Sub

txtMenuOptText.Text = Trim$(Events(EditorIndex).SubEvents(ListIndex).Text(optIdx + 1))

If Events(EditorIndex).SubEvents(ListIndex).data(optIdx) <= 0 Then Events(EditorIndex).SubEvents(ListIndex).data(optIdx) = 1

scrlMenuOptDest.value = Events(EditorIndex).SubEvents(ListIndex).data(optIdx)

End Sub

Private Sub lstSubEvents_Click()

ListIndex = lstSubEvents.ListIndex + 1

If ListIndex > 0 And ListIndex < lstSubEvents.ListCount Then

cmdSubEventDown.Enabled = True

Else

cmdSubEventDown.Enabled = False

End If

If ListIndex > 1 And ListIndex <= lstSubEvents.ListCount Then

cmdSubEventUp.Enabled = True

Else

cmdSubEventUp.Enabled = False

End If

End Sub

Private Sub lstSubEvents_DblClick()

If ListIndex > 0 And ListIndex <= lstSubEvents.ListCount Then

fraEditCommand.visible = True

PopulateSubEventConfig

End If

End Sub

Private Sub optCondition_Index_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

cmbBranchVar.Enabled = False

cmbVarReqOperator.Enabled = False

txtBranchVarReq.Enabled = False

cmbBranchSwitch.Enabled = False

cmbBranchSwitchReq.Enabled = False

cmbBranchItem.Enabled = False

txtBranchItemAmount.Enabled = False

cmbBranchClass.Enabled = False

cmbBranchSkill.Enabled = False

cmbLevelReqOperator.Enabled = False

txtBranchLevelReq.Enabled = False

Select Case Index

Case 0

cmbBranchVar.Enabled = True

cmbVarReqOperator.Enabled = True

txtBranchVarReq.Enabled = True

Case 1

cmbBranchSwitch.Enabled = True

cmbBranchSwitchReq.Enabled = True

Case 2

cmbBranchItem.Enabled = True

txtBranchItemAmount.Enabled = True

Case 3

cmbBranchClass.Enabled = True

Case 4

cmbBranchSkill.Enabled = True

Case 5

cmbLevelReqOperator.Enabled = True

txtBranchLevelReq.Enabled = True

End Select

Events(EditorIndex).SubEvents(ListIndex).data(1) = Index

End Sub

Private Sub optExpAction_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = Index

End Sub

Private Sub optChangePK_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(1) = Index

End Sub

Private Sub optChangeSex_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(1) = Index

End Sub

Private Sub optChangeSkills_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = Index

End Sub

Private Sub optChannel_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = Index

End Sub

Private Sub optChatBubbleTarget_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

If Index = 0 Then

cmbChatBubbleTarget.visible = False

ElseIf Index = 1 Then

cmbChatBubbleTarget.visible = True

End If

Events(EditorIndex).SubEvents(ListIndex).data(1) = Index

End Sub

Private Sub optItemOperation_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(3) = Index

End Sub

Private Sub optLevelAction_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = Index

End Sub

Private Sub optOpenEventType_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(3) = Index

End Sub

Private Sub optVariableAction_Click(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = Index

Select Case Index

Case 0, 1, 2

txtVariableData(0).Enabled = True

txtVariableData(1).Enabled = False

txtVariableData(2).Enabled = False

Case 3

txtVariableData(0).Enabled = False

txtVariableData(1).Enabled = True

txtVariableData(2).Enabled = True

End Select

End Sub

Private Sub scrlAddText_Colour_Change()

frmEditor_Events.lblAddText_Colour.Caption = "Color: " & GetColorString(frmEditor_Events.scrlAddText_Colour.value)

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlAddText_Colour.value

End Sub

Private Sub scrlCustomScript_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblCustomScript.Caption = "Case: " & scrlCustomScript.value

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlCustomScript.value

End Sub

Private Sub ScrlFogData_Change(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Select Case Index

Case 0

lblFogData(Index).Caption = "Fog: " & ScrlFogData(Index).value

Events(EditorIndex).SubEvents(ListIndex).data(2) = ScrlFogData(Index).value

Case 1

lblFogData(Index).Caption = "Fog Speed: " & ScrlFogData(Index).value

Events(EditorIndex).SubEvents(ListIndex).data(3) = ScrlFogData(Index).value

Case 2

lblFogData(Index).Caption = "Fog Opacity: " & ScrlFogData(Index).value

Events(EditorIndex).SubEvents(ListIndex).data(4) = ScrlFogData(Index).value

End Select

End Sub

Private Sub scrlChangeExp_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblChangeExp.Caption = "Exp: " & scrlChangeExp.value

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlChangeExp.value

End Sub

Private Sub scrlGiveItemAmount_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblGiveItemAmount.Caption = "Amount: " & scrlGiveItemAmount.value

Events(EditorIndex).SubEvents(ListIndex).data(2) = scrlGiveItemAmount.value

End Sub

Private Sub scrlGiveItemID_Change()

Dim tempIndex As Long

tempIndex = lstSubEvents.ListIndex + 1

lblGiveItemID.Caption = "Item: " & scrlGiveItemID.value & "-" & Item(scrlGiveItemID.value).name

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlGiveItemID.value

End Sub

Private Sub scrlGOTO_Change()

lblGOTO.Caption = "Goto: " & scrlGOTO.value

Dim tempIndex As Long

tempIndex = lstSubEvents.ListIndex + 1

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlGOTO.value

End Sub

Private Sub scrlChangeLevel_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblChangeLevel.Caption = "Level: " & scrlChangeLevel.value

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlChangeLevel.value

End Sub

Private Sub scrlChangeSprite_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblChangeSprite.Caption = "Sprite: " & scrlChangeSprite.value

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlChangeSprite.value

End Sub

Private Sub scrlMapTintData_Change(Index As Integer)

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Select Case Index

Case 0

lblMapTintData(Index).Caption = "Red: " & scrlMapTintData(Index).value

Events(EditorIndex).SubEvents(ListIndex).data(2) = scrlMapTintData(Index).value

Case 1

lblMapTintData(Index).Caption = "Green: " & scrlMapTintData(Index).value

Events(EditorIndex).SubEvents(ListIndex).data(3) = scrlMapTintData(Index).value

Case 2

lblMapTintData(Index).Caption = "Blue: " & scrlMapTintData(Index).value

Events(EditorIndex).SubEvents(ListIndex).data(4) = scrlMapTintData(Index).value

Case 3

lblMapTintData(Index).Caption = "Opacity: " & scrlMapTintData(Index).value

Events(EditorIndex).SubEvents(ListIndex).data(5) = scrlMapTintData(Index).value

End Select

End Sub

Private Sub scrlMenuOptDest_Change()

lblMenuOptDest.Caption = "Destination: " & scrlMenuOptDest.value

End Sub

Private Sub scrlMessageSprite_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

If scrlMessageSprite.value = 0 Then

lblMessageSprite.Caption = "Sprite: Player"

Else

lblMessageSprite.Caption = "Sprite: " & scrlMessageSprite.value

End If

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlMessageSprite.value

End Sub

Private Sub scrlOpenEventX_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblOpenEventX.Caption = "X: " & scrlOpenEventX.value

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlOpenEventX.value

End Sub

Private Sub scrlOpenEventY_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblOpenEventY.Caption = "Y: " & scrlOpenEventY.value

Events(EditorIndex).SubEvents(ListIndex).data(2) = scrlOpenEventY.value

End Sub

Private Sub scrlOpenShop_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblOpenShop.Caption = "Open Shop: " & scrlOpenShop.value & "-" & Shop(scrlOpenShop.value).name

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlOpenShop.value

End Sub

Private Sub scrlPlayAnimationAnim_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblPlayAnimationAnim.Caption = "Animation: " & scrlPlayAnimationAnim.value & "-" & Animation(scrlPlayAnimationAnim.value).name

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlPlayAnimationAnim.value

End Sub

Private Sub scrlPlayAnimationX_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

If scrlPlayAnimationX.value >= 0 Then

lblPlayAnimationX.Caption = "X: " & scrlPlayAnimationX.value

Else

lblPlayAnimationX.Caption = "X: Player's X Position"

End If

Events(EditorIndex).SubEvents(ListIndex).data(2) = scrlPlayAnimationX.value

End Sub

Private Sub scrlPlayAnimationY_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

If scrlPlayAnimationY.value >= 0 Then

lblPlayAnimationY.Caption = "Y: " & scrlPlayAnimationY.value

Else

lblPlayAnimationY.Caption = "Y: Player's Y Position"

End If

Events(EditorIndex).SubEvents(ListIndex).data(3) = scrlPlayAnimationY.value

End Sub

Private Sub scrlPositive_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblPositive.Caption = "Positive: " & scrlPositive.value

Events(EditorIndex).SubEvents(ListIndex).data(3) = scrlPositive.value

End Sub

Private Sub scrlNegative_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblNegative.Caption = "Negative: " & scrlNegative.value

Events(EditorIndex).SubEvents(ListIndex).data(4) = scrlNegative.value

End Sub

Private Sub scrlWarpMap_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblWarpMap.Caption = "Map: " & scrlWarpMap.value

Events(EditorIndex).SubEvents(ListIndex).data(1) = scrlWarpMap.value

End Sub

Private Sub scrlWarpX_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblWarpX.Caption = "X: " & scrlWarpX.value

Events(EditorIndex).SubEvents(ListIndex).data(2) = scrlWarpX.value

End Sub

Private Sub scrlWarpY_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblWarpY.Caption = "Y: " & scrlWarpY.value

Events(EditorIndex).SubEvents(ListIndex).data(3) = scrlWarpY.value

End Sub

Private Sub scrlWeatherIntensity_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

lblWeatherIntensity.Caption = "Intensity: " & scrlWeatherIntensity.value

Events(EditorIndex).SubEvents(ListIndex).data(3) = scrlWeatherIntensity.value

End Sub

Private Sub txtAddText_Text_Change()

Events(EditorIndex).SubEvents(ListIndex).Text(1) = Trim$(txtAddText_Text.Text)

End Sub

Private Sub txtBranchItemAmount_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(5) = Val(txtBranchItemAmount.Text)

End Sub

Private Sub txtBranchLevelReq_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = Val(txtBranchLevelReq.Text)

End Sub

Private Sub txtBranchVarReq_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(2) = Val(txtBranchVarReq.Text)

End Sub

Private Sub txtChatbubbleText_Change()

Events(EditorIndex).SubEvents(ListIndex).Text(1) = txtChatbubbleText.Text

End Sub

Private Sub txtMenuQuery_Change()

Events(EditorIndex).SubEvents(ListIndex).Text(1) = txtMenuQuery.Text

End Sub

Private Sub txtName_Change()

If EditorIndex <= 0 Or EditorIndex > MAX_EVENTS Then Exit Sub

Events(EditorIndex).name = txtName.Text

End Sub

Public Sub PopulateSubEventList()

Dim tempIndex As Long, i As Long

tempIndex = lstSubEvents.ListIndex

lstSubEvents.Clear

If Events(EditorIndex).HasSubEvents Then

For i = 1 To UBound(Events(EditorIndex).SubEvents)

lstSubEvents.AddItem i & ": " & GetEventTypeName(EditorIndex, i)

Next i

End If

cmdSubEventRemove.Enabled = Events(EditorIndex).HasSubEvents

If tempIndex >= 0 And tempIndex < lstSubEvents.ListCount - 1 Then lstSubEvents.ListIndex = tempIndex

Call PopulateSubEventConfig

End Sub

Public Sub PopulateSubEventConfig()

Dim i As Long, cap As Long

If Not (fraEditCommand.visible) Then Exit Sub

If ListIndex = 0 Then Exit Sub

HideMenus

'Ensure Capacity

Call Events_SetSubEventType(EditorIndex, ListIndex, Events(EditorIndex).SubEvents(ListIndex).Type)

With Events(EditorIndex).SubEvents(ListIndex)

Select Case .Type

Case Evt_Message

txtPlayerText.Text = Trim$(.Text(1))

scrlMessageSprite.value = .data(1)

fraPlayerText.visible = True

Case Evt_Menu

txtMenuQuery.Text = Trim$(.Text(1))

lstMenuOptions.Clear

For i = 2 To UBound(.Text)

lstMenuOptions.AddItem Trim$(.Text(i)) & ": " & .data(i - 1)

Next i

scrlMenuOptDest.max = UBound(Events(EditorIndex).SubEvents)

fraMenu.visible = True

Case Evt_OpenShop

If .data(1) < 1 Or .data(1) > MAX_SHOPS Then .data(1) = 1

scrlOpenShop.value = .data(1)

Call scrlOpenShop_Change

fraOpenShop.visible = True

Case Evt_GiveItem

If .data(1) < 1 Or .data(1) > MAX_ITEMS Then .data(1) = 1

If .data(2) < 1 Then .data(2) = 1

optItemOperation(.data(3)).value = True

scrlGiveItemID.value = .data(1)

scrlGiveItemAmount.value = .data(2)

Call scrlGiveItemID_Change

Call scrlGiveItemAmount_Change

fraGiveItem.visible = True

Case Evt_PlayAnimation

If .data(1) < 1 Or .data(1) > MAX_ANIMATIONS Then .data(1) = 1

scrlPlayAnimationAnim.value = .data(1)

scrlPlayAnimationX.value = .data(2)

scrlPlayAnimationY.value = .data(3)

Call scrlPlayAnimationAnim_Change

Call scrlPlayAnimationX_Change

Call scrlPlayAnimationY_Change

fraAnimation.visible = True

Case Evt_Warp

If .data(1) < 1 Or .data(1) > MAX_MAPS Then .data(1) = 1

scrlWarpMap.value = .data(1)

scrlWarpX.value = .data(2)

scrlWarpY.value = .data(3)

Call scrlWarpMap_Change

Call scrlWarpX_Change

Call scrlWarpY_Change

fraMapWarp.visible = True

Case Evt_GOTO

If .data(1) < 1 Or .data(1) > UBound(Events(EditorIndex).SubEvents) Then .data(1) = 1

scrlGOTO.max = UBound(Events(EditorIndex).SubEvents)

scrlGOTO.value = .data(1)

Call scrlGOTO_Change

fraGoTo.visible = True

Case Evt_Switch

cmbSwitch.ListIndex = .data(1)

cmbPlayerSwitchSet.ListIndex = .data(2)

fraChangeSwitch.visible = True

Case Evt_Variable

optVariableAction(.data(1)).value = True

If .data(1) = 3 Then

txtVariableData(1) = .data(2)

txtVariableData(2) = .data(3)

Else

txtVariableData(0) = .data(2)

End If

fraChangeVariable.visible = True

Case Evt_AddText

txtAddText_Text.Text = Trim$(.Text(1))

scrlAddText_Colour.value = .data(1)

optChannel(.data(2)).value = True

fraAddText.visible = True

Case Evt_Chatbubble

txtChatbubbleText.Text = Trim$(.Text(1))

optChatBubbleTarget(.data(1)).value = True

cmbChatBubbleTarget.ListIndex = .data(2) - 1

fraChatbubble.visible = True

Case Evt_Branch

scrlPositive.max = UBound(Events(EditorIndex).SubEvents)

scrlNegative.max = UBound(Events(EditorIndex).SubEvents)

scrlPositive.value = .data(3)

scrlNegative.value = .data(4)

optCondition_Index(.data(1)) = True

Select Case .data(1)

Case 0

cmbBranchVar.ListIndex = .data(6)

txtBranchVarReq.Text = .data(2)

cmbVarReqOperator.ListIndex = .data(5)

Case 1

cmbBranchSwitch.ListIndex = .data(5)

cmbBranchSwitchReq.ListIndex = .data(2)

Case 2

cmbBranchItem.ListIndex = .data(2) - 1

txtBranchItemAmount.Text = .data(5)

Case 3

cmbBranchClass.ListIndex = .data(2) - 1

Case 4

cmbBranchSkill.ListIndex = .data(2) - 1

Case 5

cmbLevelReqOperator.ListIndex = .data(5)

txtBranchLevelReq.Text = .data(2)

End Select

fraBranch.visible = True

Case Evt_ChangeSkill

cmbChangeSkills.ListIndex = .data(1) - 1

optChangeSkills(.data(2)).value = True

fraChangeSkill.visible = True

Case Evt_ChangeLevel

scrlChangeLevel.value = .data(1)

optLevelAction(.data(2)).value = True

fraChangeLevel.visible = True

Case Evt_ChangeSprite

scrlChangeSprite.value = .data(1)

fraChangeSprite.visible = True

Case Evt_ChangePK

optChangePK(.data(1)).value = True

fraChangePK.visible = True

Case Evt_SpawnNPC

cmbSpawnNPC.ListIndex = .data(1) - 1

fraSpawnNPC.visible = True

Case Evt_ChangeClass

cmbChangeClass.ListIndex = .data(1) - 1

fraChangeClass.visible = True

Case Evt_ChangeSex

optChangeSex(.data(1)).value = True

fraChangeSex.visible = True

Case Evt_ChangeExp

scrlChangeExp.value = .data(1)

optExpAction(.data(2)).value = True

fraChangeExp.visible = True

Case Evt_SpecialEffect

cmbEffectType.ListIndex = .data(1)

Select Case .data(1)

Case 3

ScrlFogData(0).value = .data(2)

ScrlFogData(1).value = .data(3)

ScrlFogData(2).value = .data(4)

Case 4

CmbWeather.ListIndex = .data(2)

scrlWeatherIntensity.value = .data(3)

Case 5

scrlMapTintData(0).value = .data(2)

scrlMapTintData(1).value = .data(3)

scrlMapTintData(2).value = .data(4)

scrlMapTintData(3).value = .data(5)

End Select

fraSpecialEffect.visible = True

Case Evt_PlaySound

For i = 1 To UBound(soundCache())

If soundCache(i) = Trim$(.Text(1)) Then

cmbPlaySound.ListIndex = i - 1

End If

Next

fraPlaySound.visible = True

Case Evt_PlayBGM

For i = 1 To UBound(musicCache())

If musicCache(i) = Trim$(.Text(1)) Then

cmbPlayBGM.ListIndex = i - 1

End If

Next

fraPlayBGM.visible = True

Case Evt_SetAccess

cmbSetAccess.ListIndex = .data(1)

fraSetAccess.visible = True

Case Evt_CustomScript

scrlCustomScript.value = .data(1)

fraCustomScript.visible = True

Case Evt_OpenEvent

scrlOpenEventX.value = .data(1)

scrlOpenEventY.value = .data(2)

optOpenEventType(.data(3)).value = True

cmbOpenEventType.ListIndex = .data(4)

fraOpenEvent.visible = True

End Select

End With

End Sub

Private Sub HideMenus()

fraPlayerText.visible = False

fraMenu.visible = False

fraOpenShop.visible = False

fraGiveItem.visible = False

fraAnimation.visible = False

fraMapWarp.visible = False

fraGoTo.visible = False

fraChangeSwitch.visible = False

fraChangeVariable.visible = False

fraAddText.visible = False

fraChatbubble.visible = False

fraBranch.visible = False

fraChangeLevel.visible = False

fraChangeSkill.visible = False

fraChangeSprite.visible = False

fraChangePK.visible = False

fraSpawnNPC.visible = False

fraChangeClass.visible = False

fraChangeSex.visible = False

fraSpecialEffect.visible = False

fraPlaySound.visible = False

fraPlayBGM.visible = False

fraSetAccess.visible = False

fraCustomScript.visible = False

fraOpenEvent.visible = False

fraChangeExp.visible = False

End Sub

Private Sub txtPlayerText_Change()

Dim tempIndex As Long

tempIndex = lstSubEvents.ListIndex + 1

Events(EditorIndex).SubEvents(ListIndex).Text(1) = txtPlayerText.Text

End Sub

Private Sub txtPlayerVariable_Change()

Events(EditorIndex).VariableCondition = Val(txtPlayerVariable.Text)

End Sub

Private Sub txtVariableData_Change(Index As Integer)

Select Case Index

Case 0: Events(EditorIndex).SubEvents(ListIndex).data(3) = Val(txtVariableData(0))

Case 1: Events(EditorIndex).SubEvents(ListIndex).data(3) = Val(txtVariableData(1))

Case 2: Events(EditorIndex).SubEvents(ListIndex).data(4) = Val(txtVariableData(2))

End Select

End Sub

```

Can you solve this problem ?

i will put your name on my credits ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

Thanks ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

Sorry for bad english ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)
Link to comment
Share on other sites

> Wrong sub.
>
> Find the scrollbar that resets to zero in the IDE.
>
> Double click on it.
>
> Paste the contents of that sub here.
>
> Find the sub EventEditorInit (If any) in modGameEditors.
>
> Paste the sub here.

hehehe, sorry ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

```
Public Sub EventEditorInit()

Dim I As Long

With frmEditor_Events

If .visible = False Then Exit Sub

EditorIndex = .lstIndex.ListIndex + 1

.txtName = Trim$(Events(EditorIndex).name)

.chkPlayerSwitch.value = Events(EditorIndex).chkSwitch

.chkPlayerVar.value = Events(EditorIndex).chkVariable

.chkHasItem.value = Events(EditorIndex).chkHasItem

.cmbPlayerSwitch.ListIndex = Events(EditorIndex).SwitchIndex

.cmbPlayerSwitchCompare.ListIndex = Events(EditorIndex).SwitchCompare

.cmbPlayerVar.ListIndex = Events(EditorIndex).VariableIndex

.cmbPlayerVarCompare.ListIndex = Events(EditorIndex).VariableCompare

.txtPlayerVariable.Text = Events(EditorIndex).VariableCondition

.cmbHasItem.ListIndex = Events(EditorIndex).HasItemIndex - 1

.cmbTrigger.ListIndex = Events(EditorIndex).Trigger

.chkWalkthrought.value = Events(EditorIndex).WalkThrought

Call .PopulateSubEventList

End With

Event_Changed(EditorIndex) = True

End Sub
```
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...