Setting Scripts/variables to where my aliases can point to them...

Posted by Laetias on Sun 10 Mar 2002 10:01 AM — 6 posts, 21,427 views.

#0
I have wraked my brain trying to figure this out. I play alot of PK muds, and PK'ing is my favorite thing. Now Im lookin for a way to set an aliase like such.<Target *>(where whatever * is saved and then I can have aliases like)
<kt=murder Variable [or] cdt=com 'demonfire' Variable> problem, I cant seem to get the coding down going from the first alias to the variable, and then for the alias to pull the information from the variable. Im just not good with code, and was wondering if yall could help me get this rolling.


Thanks fellas, and lassys.
Laetias
"My reputation grows with every failure." -Bernard Shaw-
Australia Forum Administrator #1
This is pretty easy. First you need an alias to set the variable (the target), although you could do it without scripting, by enabling scripting, and just typing:



/world.SetVariable "target", "whatever"


If, however, you want your alias ("target whatever") then make an alias like this:


Alias: target *
Label: NewTarget
Script: NewTarget


Then add the following small script to the supplied script file, or just make a small file with this in it ...


sub NewTarget (thename, theoutput, thewildcards)
  world.SetVariable "target", thewildcards (1)
end sub


Then, typing "target blah" should set the variable "target" to "blah". You can confirm that by looking at the "variables" tab in the configuration dialogue.

Having done that, everything else is simple. Make your other aliases (murder variable) like this:


Alias: murder @target
Expand variables: checked


This will cause "@target" to be replaced by the current contents of the "target" variable.
Canada #2
Just to eliminate what might be confusing, I think Nick meant to put this:

Alias: murder
Expand Variables: CHECKED
Send: murder @target

...Then you would just type "murder" by itself while connected to the mud, and the alias would append the value stored in the "target" variable.

Also, you might want some feedback when you have set a new variable. The following script is just Nick's, with an extra line added:

sub NewTarget (thename, theoutput, thewildcards)
world.SetVariable "target", thewildcards (1)
world.Note "Target: " & world.GetVariable("target")
end sub

The 'world.Note' line will send a line to your output screen confirming that the variable was set.
Australia Forum Administrator #3
Oops, you're right Magnum!

In fact, from the original post, he really wants:


Alias: kt
Send: murder @target
Expand variables: checked


And for his other example:


Alias: cdt
Send: com 'demonfire' @target
Expand variables: checked
#4
im kind of confused how to implement the script, I do not get a blank white screen like I have in working with VB3.0 and ect, so I am a little confused how to implement it.

Thanks for your help so far.
Steve
-Laetias-
#5
after I racked my brain over this for a short bit, I figured out how to use it. thanks alot fellas.

Steve
-Leatias-