The LBound to Ubound is counting through the number of items that are in the inventory list. Technically, if the text file were edited manually, this could cause an error with this routine. That's fine, I am not so concerned with that at the moment.
The script does not seem to be reading even a single line properly. The first value comes through as a wierd character followed by an n, the rest come back as null/empty.
This bug totally has me stumped, and I will not be able to complete this project until I can get past it.
Here is the complete code for my EQ project, thus far:
'------------------------------------------------------------
'
' This Script File created by "Magnum" for "Ages Of Despair".
'
' EQUIPMENT HANDLING SCRIPT
' ------------------------------------------------------------
Dim EqItemList
EqItemList = "bweap, lweap, rweap, head, neck, arms, hands, cloak, torso, belt, legs, feet, lring, rring, shield, lhold, rhold"
Sub Set_EQType (thename, theoutput, arrWildcards)
World.SetVariable "EQType", Trim(arrWildcards(1))
World.SetVariable "EQTypeStatus", "EQType: " & CStr(World.GetVariable("EQType"))
World.Note World.GetVariable("EQTypeStatus")
Display_StatusLine()
World.EchoInput = vbsTrue
EQ_Load_File "Set_EQType", theoutput, arrWildcards
End Sub
' ------------------------------------------------------------
Sub EQ_Load_File (thename, theoutput, arrWildcards)
Dim arrItems
Dim EqItem
Dim FSO, EqFileName
Dim FileContents
Dim F
Dim x
EqFileName = ScriptPath & "AOD_EQ_" & World.GetVariable("EQType") & ".txt"
World.Note "EqFileName: " & EqFileName
arrItems = Split(EQItemList, ", ")
Set FSO = CreateObject("Scripting.FileSystemObject")
If (FSO.FileExists(EqFileName)) Then
Set F = FSO.OpenTextFile(EqFileName, 1)
For x = LBound(arrItems) to UBound(arrItems)
EqItem = "EQ_" & arrItems(x)
World.Note F.ReadLine
' World.SetVariable EqItem, F.ReadLine
' World.Note EqItem & ": " & World.GetVariable(EqItem)
Next
F.Close
Else
For x = LBound(arrItems) to UBound(arrItems)
EqItem = "EQ_" & arrItems(x)
World.SetVariable EqItem, "none"
Next
EQ_Save_File "EQ_Load_File", theoutput, arrWildcards
End If
End Sub
Sub EQ_Save_File (thename, theoutput, arrWildcards)
Dim arrItems
Dim EqItem
Dim FSO, EqFileName
Dim F
Dim x
EqFileName = ScriptPath & "AOD_EQ_" & World.GetVariable("EQType") & ".txt"
World.Note "EqFileName: " & EqFileName
Set FSO = CreateObject("Scripting.FileSystemObject")
Set F = FSO.CreateTextFile(EQFileName, True, True)
arrItems = Split(EQItemList, ", ")
For x = LBound(arrItems) to UBound(arrItems)
EqItem = "EQ_" & arrItems(x)
F.WriteLine World.GetVariable(EqItem)
Next
F.Close
End Sub
' ------------------------------------------------------------
Sub EQ_Display_Inventory (thename, theoutput, arrWildcards)
Dim arrItems
Dim EqItem
Dim x
arrItems = Split(EQItemList, ", ")
World.Note World.GetVariable("EqTypeStatus")
World.Note " "
For x = LBound(arrItems) to UBound(arrItems)
EqItem = "EQ_" & arrItems(x)
World.Note PadLeft(arrItems(x), 7) & ": " & World.GetVariable(EqItem)
Next
End Sub
...continued in next message. |