mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2013
Posts: 49
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Nov 2013
Posts: 49
I've looked around a little bit - and I can't find anywhere explaining how to do this (if at all possible).

If I were to want to change the /msg into a variable containing an identifier how was one to go about doing that? Every I (for good reason) set the identifier in the variable, it doesn't add the identifier, it adds for it stands for. i.e:

on *:JOIN:#: {
set %msg msg $chan /me ||
}

would give a variable of %msg msg #lindenkron /me || --- instead of %msg msg $chan /me || (For usage in multiple channels).

Is there a way to make it save the identifier in the variable as text until it's called? Without having to set multiple variables such as msg.$chan (msg.#lindenkron) etc.

Thanks!
lindenkron,


Last edited by lindenkron; 22/11/13 08:49 PM.
Joined: Jul 2006
Posts: 4,155
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,155
You can prevent the evaluation of any identifier with the ! prefix, '$!chan' evaluates to plain text '$chan'.
However, $chan is a local identifier, it only exists during the scope of the event, so having a global variable containing $chan is most likely an error of conception.

$chan already plays the role of 'how to handle multiple channels'
Unless you can describe more in depth what you're trying to do, using this is probably not a good idea

Last edited by Wims; 22/11/13 09:46 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2013
Posts: 49
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Nov 2013
Posts: 49
Thanks for your reply. I'll try the $!chan out.

What I'm trying to do is make it so when I use %msg instead of msg for my bot - it'll show the same specific start of every "msg" line, regardless of what channel it is currently in.

So in a command instead of having to do "msg $chan /me || What ever message" I could just do %msg What ever message - and it would be displayed in whatever channel the command is called from.

Thanks!
Edit: This way returns "*$chan* /me || hi" in the command window, instead of the actual channel chat. Hmm.

Last edited by lindenkron; 22/11/13 09:55 PM.
Joined: Jul 2006
Posts: 4,155
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,155
You're confused, if you have 'on *:text:*something*:#chan1,#chan2:{'

The event will trigger twice, once with $chan = #chan1, once again with $chan = #chan2, you don't have to do anything special but: var %msg msg $chan | %msg this is the message


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2013
Posts: 49
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Nov 2013
Posts: 49
Originally Posted By: Wims
You're confused, if you have 'on *:text:*something*:#chan1,#chan2:{'

The event will trigger twice, once with $chan = #chan1, once again with $chan = #chan2, you don't have to do anything special but: var %msg msg $chan | %msg this is the message


I did do
on *:JOIN:#: {
set %msg $chan /me ||
}

Problem with that is, every time I then use the %msg it's to a specific channel. As it sets it on the first channel it joins it'll then forever be msg #lindenkron /me ||. So if the bot is called upon to send a message, it calls %msg which doesn't use $chan, but instead will use the #lindenkron which the variable saved (To every channel, not just #lindenkron).

I don't think I'm confused here mate - not sure if you understand me though smile.

Last edited by lindenkron; 22/11/13 10:10 PM.

Link Copied to Clipboard