| Message |
OK, let me contribute a bit to this thread... I didn't read all of it, because, I'm too lazy, but I think this'll help :P
I made a script to count EQ damage a while ago. Uses two-dimensional VBScript global variables to store the data and then loads/saves them in MC variables when it's done.
Here is a general example of arrays in VB:
Dim varArray(2)
Dim varDamage()
varArray(1) = "Test"
varArray(2) = "Test 2"
Sub AddItem(strItem)
Redim Preserve varDamage(UBound(varDamage) + 1)
varDamage(UBound(varDamage)) = "Store this"
End Sub
That way, you can initialise and resize a variable at runtime. There are many functions to search, store and load arrays to MC variables in my script, ready to be used.
I'm pasting a few because the script is no longer online:
Sub subSaveArray
Dim intCounter
Dim strContents
Dim intArrayCounter
For intCounter = 0 to UBound(strEQTable, 2)
strContents = strEQTable(0, intCounter)
For intArrayCounter = 1 to constTableItems
strContents = strContents & "|" & strEQTable(intArrayCounter, intCounter)
Next
world.SetVariable "EQHit_Item_" & intCounter, strContents
Next
End Sub
Function fnFindItem (strItemName)
Dim intCounter
For intCounter = 0 to UBound(strEQTable, 2)
If UCase(strEQTable(0, intCounter)) = UCase(strItemName) Then
fnFindItem = intCounter
Exit Function
End IF
Next
fnFindItem = -1
End Function
The function to load the array was a bit huge due to script-specific stuff, but I'm sure you can reverse the save one.
VB is a bit hazy when it comes to arrays. I still don't know to this day what the lower bound of a VB array is. I.e. if i declare varArray(7), is the lower bound 0, or 1? and is the high bound 7, or 6? Confusing... Anyway, I hope I helped. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | top |
|