World.Sends processed for aliases?

Posted by Neurowiz on Fri 20 Dec 2002 03:35 AM — 4 posts, 19,016 views.

#0
OK, albiet this is probably a strange question, please bear with me.

I need my keypad to be in two modes, normal and Player vs. Player mode.

I've used some of Nick's great ideas and have the following example:

The 0 keypad key sends KP10 (bear with me) to the world. My alias KP* picks it up.

I have a function called keypadAction that does the following:
Sub keypadAction(a,b,c)
Dim key
key = CInt(trim(c(1)))
world.send Keypad(key, currKeypad)
End Sub

OK, so Keypad(x,y) is an array that has the various actions that I want to have happen. So far so good. Here's an example for Keypad 0 (which is the 10th element in my array, hence the KP10)
Keypad(KEY0, NORMAL) = "look"
Keypad(KEY0, PVP) = "actionDsl"

Now comes the nasty bit. If I'm in normal mode, Keypad 0 key will do a "look". If I'm in PVP mode, I *want* the value sent through world.send to be processed as an alias, so that I can set an alias called "actionDSL" and run a script.

Problem is that it won't work. It *seems* as if because I'm running a current alias (KP*) and calling a script, that I can't go ahead and have another alias run... or world.send doesn't run through the aliases. I haven't actually searched for that particular issue, so I guess I should.. but help? In some cases, when I'm in PVP mode, I'm going to need to run scripts based on the keypad key I've pressed, rather than just a simple send to the world... and I want it to be nice and reconfigurable, hence why I don't hardcode things.

Thanks!
Canada #1
Text sent via World.Send (or World.LogSend) is not processed by the alias engine.

You'll have to script some other arrangement to do what you want.

In VBS:

Sub OnKeyPress (AliasName, AliasLine, arrWildcards)
  If currKeypad = "1" Then
    Keypress_Normal arrWildcards(1)
  Else     ' Assume currKeypad is "2"
    Keypress_PvP arrWildcards(1)
End Sub

Sub Keypress_Normal (Keynumber)
  Dim key
  key = CInt(Trim(Keynumber))
  World.LogSend Keypad(key, currKeypad)
End Sub

Sub Keypress_Pvp (Keynumber)
  Dim key
  key = CInt(Trim(Keynumber))
  '...
End Sub

What you do where the '... line is placed is up to you. You might put the name of the subroutine as a value in your array and then use 'GlobalExecute', or you might use a CASE\IF structure to check the value and call the corresponding script.
Amended on Fri 20 Dec 2002 05:27 AM by Magnum
Australia Forum Administrator #2
Magnum is right, world.sends aren't processed through alias recognition. I can imagine some rather nasty loops if they were.

eg.

Match on: xyzzy
Alias calls: DoXYZZY
sub DoXYZZY does world.send "xyzzy"
This matches the alias again.
Alias calls the sub again.
And so on indefinitely.

I would do what he suggests - call a sub which tests the PVP mode flag and sends the appropriate thing according to that.
Australia Forum Administrator #3
Quote:

Now comes the nasty bit. If I'm in normal mode, Keypad 0 key will do a "look". If I'm in PVP mode, I *want* the value sent through world.send to be processed as an alias, so that I can set an alias called "actionDSL" and run a script.


See new script command: world.Execute