increasement of dim

Posted by Simon on Fri 10 Aug 2001 09:52 PM — 2 posts, 14,160 views.

Sweden #0
sub AddDodgeS (strTriggerName, strLine, arrWildCards)
dim dodgeS = world.getvariable ("dodgesuccess")
dodgeS = dodgeS + 1
world.setvariable "dodgesuccess", dodgeS
end sub


How come this won't work? guess it's something with the dodgeS = dodgeS + 1 or something?

Please help :)

/Simon
Australia Forum Administrator #1
VB doesn't let you assign a variable to a DIM on the same line you declare it. What would work is this:


sub AddDodgeS (strTriggerName, strLine, arrWildCards)
dim dodgeS
dodgeS = world.getvariable ("dodgesuccess")
dodgeS = dodgeS + 1
world.setvariable "dodgesuccess", dodgeS
end sub


However a shorter version (which does away with the DIM altogether) would be:


sub AddDodgeS (strTriggerName, strLine, arrWildCards)
world.setvariable "dodgesuccess", world.getvariable ("dodgesuccess") + 1
end sub