mIRC Home    About    Download    Register    News    Help

Print Thread
#251348 16/02/15 09:03 AM
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I am trying to set a variable that will call out the specified username in chat. For example !welcome powerade661 and then it says "welcome to stream powerade661" Please help frown


Code:
on *:TEXT:!welcome %cloud:#: {
  set %cloud = $nick
  msg $chan Welcome to the stream %cloud
}


Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
That's not how it works smile You need the numbered parameters $1 $2 $3 etc, or $1- $2- $3- etc.

Code:
on *:TEXT:!welcome *:#: {
  var %nick = $$2
  msg $chan Welcome to the stream, %nick $+ !
}


Changed "!welcome %cloud" to "!welcome *", which means instead of having to match the word "!welcome" followed by whatever the previous value "%cloud" was set to, it now accepts "!welcome <anything>".

Changed "set" to "var" so it's not stored permanently.

Changed "%cloud" to "%nick" because it's more descriptive instead of being a random word.

"$2" means "the second word", which happens to be whatever follows "!welcome".

Using two "$" for "$$2" means the script will halt (stop) if empty (not specified).


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Thank you so much, this works great. I really appreciate your help on this.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Certainly!


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard