|
|
Joined: Sep 2007
Posts: 65
Babel fish
|
OP
Babel fish
Joined: Sep 2007
Posts: 65 |
Would it be possible to make a command that works like this?: on *:input:test: {
/somecmd
/some special cmds here
/more special cmds here
/endsomecmd
} Or maybe use {}-brackets like in If-statements? What I mean, is that if I then entered echo as one of the "special cmds" in the middle, it wouldnt be parsed as the normal echo alias, but rather something else. Thanks.
GamerzWoWThe Official GamerzPlanet WoW Server
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
You can make aliases. Example:
alias sample {
echo 2 -a This is line 1
echo 3 -a This is line 2
echo 4 -a This is line 3
}
on *:INPUT:test:{
sample
}
-genius_at_work
|
|
|
|
Joined: Sep 2007
Posts: 65
Babel fish
|
OP
Babel fish
Joined: Sep 2007
Posts: 65 |
Mm, more like this Python implementation I found: alias testpython {
echo -s Testing Python!
goto $startpy($script, $scriptline)
print 'Testing Python #2'
for x in reversed(xrange(3)):
print x
def testfunc():
print 'Testing Python #3'
testfunc()
:0
echo -s An exception occurred somewhere!!
return
:1
echo -s Test successful!
}
Last edited by XTZGZoReX; 19/01/08 09:09 PM.
GamerzWoWThe Official GamerzPlanet WoW Server
|
|
|
|
Joined: Dec 2002
Posts: 2,031
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,031 |
A while loop?
/help /while
|
|
|
|
Joined: Sep 2007
Posts: 65
Babel fish
|
OP
Babel fish
Joined: Sep 2007
Posts: 65 |
Erm, let's take it another way... on *:input:*: {
if ( $1 == lala ) {
do something
}
} We all know the /if command. Basically, what I want to do is make a command where I can use the {} brackets like in /if.
GamerzWoWThe Official GamerzPlanet WoW Server
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
The best method is to use an alias as was suggested. Of course, that's without knowing what you're trying to do. But you wouldn't just be able to throw {}'s for multiple lines anywhere you want... they'd only be valid with commands that accept them (if, elseif, else, etc).
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Sep 2007
Posts: 65
Babel fish
|
OP
Babel fish
Joined: Sep 2007
Posts: 65 |
That's what I mean. /if, /else, /elseif are all commands. So I thought that it might be possible to make aliases that accept {}-brackets too?
GamerzWoWThe Official GamerzPlanet WoW Server
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
/if, /elseif, /else, /while, etc are not commands. They are control structures. That is why commands do not accept { } brackets.
-genius_at_work
|
|
|
|
Joined: Sep 2007
Posts: 65
Babel fish
|
OP
Babel fish
Joined: Sep 2007
Posts: 65 |
So it is not possible in any way?
Well, then: Is it possible to check what the last executed command was?
GamerzWoWThe Official GamerzPlanet WoW Server
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
It is only possible in the way described, by using an /alias. It is not possible in the way you are looking for.
The last executed command is the one immediately before the currently executing command. It is your script, so you should know in what order the commands are executed.
-genius_at_work
|
|
|
|
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334 |
if he hasnt figured it out, i think he wants a for event :: or something that acts like it
This is not the signature you are looking for
|
|
|
|
Joined: Sep 2007
Posts: 65
Babel fish
|
OP
Babel fish
Joined: Sep 2007
Posts: 65 |
No - it's not like I don't know what the last command was, but I'm trying to make an alias that depends on the lastly executed command.
GamerzWoWThe Official GamerzPlanet WoW Server
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Have the alias called with some identifing word/character/number so you know where it's called from... For example, if the alias is called "Stats", you can call it as /stats ontext or /stats onnotice or /stats oninput or something like that. If that's not an option, have the events that the alias cares about set a variable with the same kind of identifying item that the alias will check when called.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Sep 2007
Posts: 65
Babel fish
|
OP
Babel fish
Joined: Sep 2007
Posts: 65 |
Haha. Good idea. Never really though of that. Thanks! I suppose that'll be it for now.
GamerzWoWThe Official GamerzPlanet WoW Server
|
|
|
|
Joined: Sep 2007
Posts: 65
Babel fish
|
OP
Babel fish
Joined: Sep 2007
Posts: 65 |
Oh and, I would like to update you guys here. on *:input:*: {
if ( $1 == .php ) {
<?php {
echo -a Uses brackets!
} ?>
echo -a Really!
}
}
alias <?php {
set %php true
}
alias ?> {
unset %php
} So apparently, you can use brackets in your own aliases, in case any of you wondered/didn't know.
GamerzWoWThe Official GamerzPlanet WoW Server
|
|
|
|
|
|