Gammon Forum
Entire forum
MUSHclient
Jscript
inside functions
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Avariel
Portugal (55 posts) bio
|
Date
| Fri 26 Jul 2002 01:06 PM (UTC) |
Message
| i need help in 2 things.
1rst:
im trying to run alias inside script functions... dunno if thats possible but if it is id like to someone hepls me with sintax cus im not being able of doing it.
2nd:
i have a diferent function for each of my chars with the names like this
afk_<char_name_1>
afk_<char_name_2>
afk_<char_name_3>
when i connect to the mud i have a function that sets
self = <char_name>
ide like to know if it possible to set a function that runs afk_self function inside it... meaning that recognizes the variable set on connection and choses the right afk_* function. if its possible how do i do it.
thx. |
The Avariel Wind Lord | top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #1 on Fri 26 Jul 2002 10:47 PM (UTC) |
Message
|
Quote:
im trying to run alias inside script functions...
You can't call aliases from scripts, because of the possibility of an endless loop. Eg. alias A calls script B, script B calls alias A and so on.
However, what you can do is make a variable, eg.
variable XXX = "go north"
Then the alias uses the variable, eg.
alias YYY = "@xxx"
With "expand variables" set this would send "go north".
Then in your script you can also use the same variable, eg.
world.send world.getvariable ("XXX")
This would send "go north".
Quote:
ide like to know if it possible to set a function that runs afk_self function inside it.
You can do this with the VB "execute" command. eg.
Execute "call afk_" & world.getvariable ("self")
This tells VB to join "afk_" with the contents of variable "self" then execute "call afk_self" (whatever self is). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #2 on Fri 26 Jul 2002 10:57 PM (UTC) |
Message
| I just noticed this is the Jscript part of the forum, but the answer is very similar. Instead of "Execute" you would use "eval", like this:
eval ("afk_" + world.getvariable ("self") + " () ;");
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Avariel
Portugal (55 posts) bio
|
Date
| Reply #3 on Wed 31 Jul 2002 01:48 PM (UTC) |
Message
| thank you, Nick
I'll probably gonna have some more questions as I try to do more complex alias :)
this reply will help me a lot.
have fun. |
The Avariel Wind Lord | top |
|
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.
12,032 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.