hehe, I don't spam dsl :P I'm thinking about making an auto-envenom alias, (i.e. like.. hit an alias, call a sub, or something, then every balance envenom my swords with what venoms are in the combo line next) but otherwise I just hit my macros on balance, or raze if I need to, you play achaea?
If you are concerned about speed of execution then my third suggestion would work slower than putting it all into individual subs, but the loss in speed will become noticable only if you call the Keypad_1 sub a few hundred times in a row probably, which is not likely to ever happen. So speed is much less of an issue here than not getting lost in your script file later on is ;)
P.S. If you want an additional advice then don't prepend DSL to the envenoming commands, since that way you'll have a hard (or to be more exact - expensive) time spamming DSL. Envenom with one alias and DSL with another one. That's more buttons to press but won't waste you half a vial of venom on every balance cycle.
Hmm, coming back to it... You can replace the multitude of En_* subs with a single Envenom one:
Dim leftsword, rightsword
leftsword = World.GetVariable("varLeftSwd")
rightsword = World.GetVariable("varRightSwd")
Sub Envenom (weapon, venom)
Select Case LCase(weapon)
Case "left"
World.Send "envenom " & leftsword & " with " & venom
Case "right"
World.Send "envenom " & rightsword & " with " & venom
End Select
End Sub
Sub Keypad_1 (a,b,wildcard)
Envenom "left", "aconite"
Envenom "right", "curare"
World.Send "dsl " & target
End Sub
This will do the same thing, since the venom to be applied is passed to the Envenom sub along with the weapon hand, so you can do away with all the individual venom subs and use just one.
Ok, my bad - too early in the morning and I didn't have my coffee yet. I see what you are trying to do here. Here's an amended version of your script that should work fine:
Dim leftsword, rightsword
leftsword = World.GetVariable("varLeftSwd")
rightsword = World.GetVariable("varRightSwd")
Sub En_Aco (weapon)
Select Case LCase(weapon)
Case "left"
World.Send "envenom " & leftsword & " with aconite"
Case "right"
World.Send "envenom " & rightsword & " with aconite"
End Select
End Sub
Sub Keypad_1 (a,b,wildcard)
En_Aco "left"
En_Cur "right"
World.Send "dsl " & target
End Sub
This will work as long as you have a 'target' variable defined somewhere. You'll notice that I substituted 'rapier' for 'weapon' in En_Aco sub's argument list, I thought you didn't just use rapiers so why confuse yourself :) But that's just a bullyish suggestion and should be regarded as such.
There 2 problems here. One is that your En_Aco sub is declared to accept 3 arguments when it is called:
Sub En_Aco (a,b,rapier)
and you are trying to force it to accept only 1 argument:
En_Aco left
that doesn't work in vbscript at all. The second problem is with the argument that you are trying to feed to the envenoming sub. You say:
left
and vbscript treats that as a variable name, but since there are no variables by that name declared anywhere in your script, the call generates an error. Try to figure out what exactly you are trying to do with the argument, judging from the En_Aco sub it should be some sort of an array, but again - no arrays to be seen anywhere.
Hello, I'm trying to call a sub from another sub. Here's my code:
Quote:
Dim leftsword, rightsword
leftsword = World.GetVariable("varLeftSwd")
rightsword = World.GetVariable("varRightSwd")
Sub En_Aco (a,b,rapier)
Select Case LCase(rapier(1))
Case "left"
World.Send "envenom " & leftsword & " with aconite"
Case "right"
World.Send "envenom " & rightsword & " with aconite"
End Select
End Sub
Sub Keypad_1 (a,b,wildcard)
En_Aco left
En_Cur right
World.Send "dsl " & target
End Sub
<aliases>
<alias
script="keypad_1"
match="^keypad\-1$"
enabled="y"
group="offense"
regexp="y"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
</alias>
</aliases>
And I've got ctrl+1 on the keypad set up to send keypad-1 (the alias)
When I do so, I get this error:
Quote:
Error number: -2146827838
Event: Execution of line 413 column 3
Description: Wrong number of arguments or invalid property assignment: 'left'
Called by: Function/Sub: keypad_1 called by alias
Reason: processing alias ""
I'm not quite exactly sure how to call a sub from another sub with arguments, any ideas?
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.