alias limitations

Posted by Girdy on Sun 14 Apr 2002 05:12 AM — 6 posts, 23,227 views.

#0
Okay, tell me if this is possible.

I'd like to have floating variables that different aliases can assess. For example, lets say that I have three attacks, kick, punch and jab.

I'd like to create a targetting variable:

alias: tt *
does: $target= %1

And then use other aliases using the target variable.

alias: k
does: kick $target


Is this possible?
Australia Forum Administrator #1
It is possible. First the second, easy part. You can refer to a variable in an alias by preceding it by "@" provided you check the "Expand variables" box.

eg.


kick @target


To set the variable, you can make an alias to do that, however the alias needs to call a small script. eg.


alias: tt *
send: (nothing)
label: settarget
script: OnSetTarget


In the script file:


sub OnSetTarget (strName, strLine, aryWildcards) 
  world.setvariable "target", aryWildcards (1)
end sub


If you don't want to make a script, you can do it manually providing scripting is enabled. Just type:


/world.setvariable "target", "dragon"
#2
alias: tt *
send: (nothing)
label: settarget
script: OnSetTarget

I understand that script calls the Sub OnSetTarget script, but what does the label do?
Australia Forum Administrator #3
The label gives the alias a name. It is required because the script routine gets the name passed to it. However the name is fairly arbitrary. I suggested recently to someone else they use the names to organise their trigger and aliases. eg. the name could just as well be:

label: alias_to_set_the_target_variable

That way you can browse through the labels in the alias window to see what each one does.
#4
Really? So any subroutine I write has to have at least (strName, strLine) as predeclared variables?
Australia Forum Administrator #5

Not exactly. See Callback routines for details about the arguments you should use for each subroutine.