I've tried this again and again in so many different ways, and I can't figure out what I'm doing wrong. I have a piece of code up the top of my VBScript file like this:
And that works fine. I'm able to do things like Volute.GetVariable("Blah") and Volute.SetVariable "Blah", "Blah blah blah" without any troubles.... however, when I try to use two different Volute.SetVariable lines in the same Sub, it will only do one of them:
The strange part about it is, even if I swap the two around, "Stat_" & Loser remains the one that won't set. I've checked the variable, it's there and index 16 is 0, but won't change. Anyone know what's going on here?
Set Volute = world.GetWorld ("Volute")
If isempty(Volute) Then
world.Note "--- Database is not open."
Else
world.Note "--- Database has been accessed."
End IfAnd that works fine. I'm able to do things like Volute.GetVariable("Blah") and Volute.SetVariable "Blah", "Blah blah blah" without any troubles.... however, when I try to use two different Volute.SetVariable lines in the same Sub, it will only do one of them:
Sub TestMe(Winner, Loser)
WinFile = Volute.GetVariable("Stat_" & Winner)
LosFile = Volute.GetVariable("Stat_" & Loser)
If isempty(WinFile) Or isempty(LosFile) Then
world.Note "--- Cannot find variable!"
Exit Sub
End If
WinStat = split(WinFile, ",")
LosStat = split(LosFile, ",")
world.Note "--- " & Winner & " WinStat(16): " & WinStat(16)
world.Note "--- " & Loser & " LosStat(16): " & LosStat(16)
WinStat(16) = cint(WinStat(16)) + 3
LosStat(16) = cint(LosStat(16)) + 1
world.Note "--- New " & Winner & " WinStat(16): " & WinStat(16)
world.Note "--- New " & Loser & " LosStat(16): " & LosStat(16)
Volute.SetVariable "Stat_" & Winner, join(WinStat, ",")
Volute.SetVariable "Stat_" & Loser, join(LosStat, ",") '<--- DOESN'T WORK!
world.Note "--- Stat_" & Loser
End Sub
Quote:
--- janx WinStat(16): 9
--- kodax LosStat(16): 0
--- New janx WinStat(16): 12
--- New kodax LosStat(16): 1
--- Stat_kodax
--- janx WinStat(16): 12
--- kodax LosStat(16): 0
--- New janx WinStat(16): 15
--- New kodax LosStat(16): 1
--- Stat_kodax
--- janx WinStat(16): 15
--- kodax LosStat(16): 0
--- New janx WinStat(16): 18
--- New kodax LosStat(16): 1
--- Stat_kodax
--- janx WinStat(16): 18
--- kodax LosStat(16): 0
--- New janx WinStat(16): 21
--- New kodax LosStat(16): 1
--- Stat_kodax
--- janx WinStat(16): 9
--- kodax LosStat(16): 0
--- New janx WinStat(16): 12
--- New kodax LosStat(16): 1
--- Stat_kodax
--- janx WinStat(16): 12
--- kodax LosStat(16): 0
--- New janx WinStat(16): 15
--- New kodax LosStat(16): 1
--- Stat_kodax
--- janx WinStat(16): 15
--- kodax LosStat(16): 0
--- New janx WinStat(16): 18
--- New kodax LosStat(16): 1
--- Stat_kodax
--- janx WinStat(16): 18
--- kodax LosStat(16): 0
--- New janx WinStat(16): 21
--- New kodax LosStat(16): 1
--- Stat_kodax
The strange part about it is, even if I swap the two around, "Stat_" & Loser remains the one that won't set. I've checked the variable, it's there and index 16 is 0, but won't change. Anyone know what's going on here?