|
dantelestat Beginner
Joined: 30 Jul 2001 Posts: 20
|
Posted: Thu Jan 24, 2002 12:45 am
user defined functions |
I never tried this before but i need to make a function and the #function command is not working at all. what could be the cause? This is what I am trying to implement:
#fu go {#if (@wield=="crossbow") {dismount;#temp {You have regained your balance.} {go %1}} {go %1}}
nothing happens if I type that in the command line and I don't see a function window like there is for aliases/triggers/variables/etc and if I type #fu alone i don't get a list of the function I just made. I was expecting that would list all user defined functions so I am a bit confused. |
|
|
|
Palomar Apprentice
Joined: 11 Oct 2000 Posts: 138 Location: Portugal
|
Posted: Thu Jan 24, 2002 1:20 am |
1. You can edit a function as you edit variables.
2. What you want is an alias (that can execute commands like #IF) and not a function (that evaluates an expression + returns a result).
Palomar |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Thu Jan 24, 2002 1:45 am |
Like Palomar said, this could probably be set up as an alias instead. Be careful, you're going to create a loop if you do it the way you're doing. Try this:
#alias go {#if (@wield="crossbow") {dismount;#temp {You have regained your balance.} {~go %1}} {~go %1}}
Iljhar |
|
|
|
dantelestat Beginner
Joined: 30 Jul 2001 Posts: 20
|
Posted: Thu Jan 24, 2002 4:01 am |
no you don't understand perhaps it is my fault. I was looking to make go a function because it must take the argument of the building name. This is a function which lets me enter buildings so i want to type go Louvre for example and let "Louvre" be the argument passed in.
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Jan 24, 2002 4:05 am |
Yes, aliases can receive arguments to. When you call an alias, you pass arguments to it by simply writting them after the alias name. Suppose you have an alias called test, then:
test arg1 arg2
passes arg1 and arg2 as arguments. You can access the arguments inside the alias with %1, %2, etc.
Kjata |
|
|
|
dantelestat Beginner
Joined: 30 Jul 2001 Posts: 20
|
Posted: Thu Jan 24, 2002 4:07 am |
my apologies it did in fact work as an alias i had no idea you could pass variables into aliases in the form of %1 %2 etc. thanks for the help
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Jan 25, 2002 3:06 am |
quote:
my apologies it did in fact work as an alias i had no idea you could pass variables into aliases in the form of %1 %2 etc. thanks for the help
User-defined functions can't take advantage of the much more direct (if not powerful) #command procedures.
li'l shmoe of Dragon's Gate MUD |
|
|
|
|
|