|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
I need to enable and disable a welcome message using aliases. Something like this: =### Public-Command ###
=/xtry {
= on 1!:JOIN:#: {if (%nick != Dylan666_) {/msg hello guy whoever you are! }
= else { /msg hi dear old firend!}
= } But "on join" is not a command... What should I do? Could this be useful? http://www.mishscript.de/help/mircbot.htm#s3How?
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
you can use groups, which is the ability to turn chuncks of code on and off below i have called the "group" xtry see the #xtry group directive, it is initiallt disabled/OFF "#xtry off" and the group ends at "#xtry end" becuase its disabled the alias "xtry" in it does not function, so if you tyrp /xtry it runs the one below it outside the group this turns the group ON, and so the next time you run /xtry the one iside the group is located first and run, whcih switches it off again. Also insode the group is the ON JOIN event, which only runs when the group is enabled/ON #xtry off
on 1!:JOIN:#: {
if ($nick != Dylan666_) {
msg $nick hello guy whoever you are!
}
else {
msg $nick hi dear old firend!
}
}
alias xtry { .disable #xtry | echo -a Xtry OFF }
#xtry end
alias xtry { .enable #xtry | echo -a Xtry ON } ** my naming the group xtry and the alias xtry was just for convenence there is no codistic need for this ** [i]edit, just corercted the on join event removing %nick and adding $nick
Last edited by DaveC; 20/05/06 05:26 AM.
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
Well reading what you have said I have modified the script in this way
=### Public-Command ###
=/xtry {
= #xtry off
= on 1!:JOIN:#: {
= if ($nick != Dylan666_) {
= msg $nick hello guy whoever you are!
= }
= else {
= msg $nick hi dear old firend!
= }
= }
= alias xtry { .disable #xtry | echo -a Xtry OFF }
= #xtry end
= alias xtry { .enable #xtry | echo -a Xtry ON }
=} But there are two problems: First: using the command I get this message: * /alias: unable to remove 'xtry' (line 28, xdcc.ini) (line 38, xdcc.ini) Second: the script wrtite the message as soon asI use the command even if no news users has joined, but when someone joins it doesn't writes anything
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
The main problem is you are putting an event inside of an alias, and then even putting 2 more aliases inside, which of course is not going to work as you expect it to. Each alias should be on its own, along with the join event.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Well reading what you have said I have modified the script in this way well try unmodifying it, and placing it in a remote file, ALT-R/File/new
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
That is the point: i need to put the "on join" event and the aliases in a redistributable script, so i cant use the ALT-R/File/new window.
Do you think "/enable {#groupname}" could be useful? Where sould I add it in the script?
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
once YOU have made the file (save it with a specific name like mycooldeal.mrc) you can share that with whoever and they then would load the file (/load -rs mycooldeal.mrc)
another way for you to make the file would be to type in a mIRC window /run notepad mycooldeal.mrc notepad will open but not finding the file will prompt you "Did you want to make the file" answer yes and load it as I pointed out above alt+r view/mycooldeal.mrc and get to work.
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
Of course, but the script doesn't work...
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
go back to what DaveC showed you, and what shaefer31 told you
your way: doesn't work Their way: works
remove any of the old aliases you wrote put the commands into a Remote file try again.
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
Ok, I did it. I have created a file called myscript_remote.ini (for DaveC's part of code) and myscript.ini (for aliases). It works, but now my script is made of two files and i have to load them with two command lines:
/load -a myscript_remote.ini /load -rs myscript.ini
How culd i automatically load one file from the other?
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
Put them all in the same file perhaps?
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
If I load the "on join" as alias it doesn't work If I load the rest of the script (with aliases) with -rs it doesn't work
And so?
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
If I load the "on join" as alias it doesn't work If I load the rest of the script (with aliases) with -rs it doesn't work
And so? On Join events do NOT GO IN ALIASES and so, get rid of the alias file completely erase the remote file you made and copy/paste the code davec provided type the /xtry command you will see enabled or disabled for the group if it says disabled it wont work type it again and it should say enabled and thus work
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
That On Join events dest NOT GO IN ALIASES it's ok
But my script has many other parts (with no "on join" event) and many other aliases (as /xask that combines some /msg commands).
Is it ok if I copy all the other aliases from "myscript.ini" (load using -a option) to "miscript_remote.ini" (where i put /xtry) changing them from "/xask {/msg bla bla bla}" format to "alias xask {/msg bal bla}" format?
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
look just copy all the lines from the alias file into the remote file, then delete the alias file, then go back to the remote file and where ever you start a command such as
/blah { msg $1 blah }
change this to being
ALIAS /blah { msg $1 blah }
the only reason your commands dont work in the remotes section is becuase they require the keyword ALIAS placed at the start of each command, to inform mirc its an alias. (you well note that mine had these, becuase i expected you to place it in the remotes section, sicne it had a remote event in it , the ON JOIN)
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
Perfect, now the most difficult question: insetad of "Dylan666_" i need to put there a variable. Well, I mean something like this: = alias xback {
= set %UserComeBack $?="Who is away:"
= if (%UserComeBack== $null) { halt }
= else {
= #xtry off
= on 1!:JOIN:#: {
= if ($nick != %UserComeBack) {
= msg $nick hello guy whoever you are!
= }
= else {
= /msg %AwayBotName oh, where were you? I please contact me as soon as possible
= }
= } I need tu use a prompt do set the name of the user to contact when joins on the channel If he comes back the script send a message to him, else it writes a generic message
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
ok to start with STOP PUTTING EVENTS INSIDE ALIAS"S!and now to ya code adjusted it below usage /xback <name> <name> is optional if none is inserted it well be asked for. alias xback {
set %UserComeBack $iif($1 != $null,$1,$?="Who is away:")
if (%UserComeBack == $null) { .disable #xtry } | else { .enable #xtry }
}
;
; I dont know where the other code went so ill just show what u had here
;
#xtry off
on 1!:JOIN:#: {
if ($nick != %UserComeBack) {
msg $nick hello guy whoever you are!
}
else {
msg $nick oh, where were you? I please contact me as soon as possible
}
}
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
Ok, all is ok
Last edited by Dylan666; 22/05/06 01:06 PM.
|
|
|
|
Joined: Aug 2003
Posts: 50
Babel fish
|
OP
Babel fish
Joined: Aug 2003
Posts: 50 |
Last question (I mean in this topic ): After the welcome message I need something like this: echo -a 4,1 EVENT 1,4 You send a wellcome message to %UserComeBack for #%Number timesI'd like to use "#" simbols without the script use it as "channel name" variable I'd like to use %UserComeBack without the spaces before and after the variable name. -------------------------------- Ok I used $+ to solve the problem
Last edited by Dylan666; 22/05/06 04:58 PM.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
echo -a 4,1 EVENT 1,4 You send a wellcome message to $+(,%UserComeBack, for $chr(35),%Number times)
$chr(35) = # & $+ (as u said) or the more comprehesive $+(part,part,part)
|
|
|
|
|