mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
I have been trying to attempt this for... idk how long today. But I can't get it to work. I want a custom join message for certain people. So when they come in, the stream and I know they joined.

The current script I have right now:
Code:
on *:join:#: {
  if ($nick == NICKHERE) {
    msg # NICKHERE has joined the stream!!!
  } else return
}
on *:join:#: {
  if ($nick == NICK2HERE) {
    msg # NICK2HERE is lurking, watch out for the ban hammer!!!
  } else return
}



With this, only the first one shows up when they join. No join commands work after that.

EDIT:

Alright, I realized my mistake and worked through it. For anyone else that might want to know just edit this with the nick's of who you want custom welcome messages for and edit the msg as well.


Code:
on *:join:#: {
  if ($nick == NICKHERE) {
    msg $chan Hey $nick welcome back bro!!
  }
  if ($nick == WIFESNICK) {
    msg $chan *insert darth vader theme music* Oh, I mean... Hello wifey!
  }
}

Last edited by Bramzee; 27/04/14 02:04 AM.
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
So, after reading he help files I've fixed this up a bit. More to my liking, because I learned something from this.


Here's the what I have:

Code:
on *:join:#: {
  if ($nick == username1) goto one
  elseif ($nick == username2) goto two
  elseif ($nick == username3) goto three
  elseif ($nick == username4) goto four
  elseif ($nick == username5) goto five
  elseif ($nick == username6) goto six
  elseif ($nick == username7) goto seven
  else goto unknown
  :one
  { msg # custom welcome message }
  halt
  :two
  { msg # custom welcome message }
  halt
  :three
  { msg # custom welcome message }
  halt
  :four
  { msg # custom welcome message }
  halt
  :five
  { msg # custom welcome message }
  halt
  :six
  { msg # custom welcome message }
  halt
  :seven
  { msg # custom welcome message }
  halt
  :unknown
  if ((%floodwelcome) || ($($+(%,floodwelcome.,$nick),2))) { return }
  set -u10 %floodwelcome On
  set -u99999999999 %floodwelcome. $+ $nick On
  { msg # Hey $nick welcome to the stream!! hope you decide to stick around and hangout for a bit, and don't forget to follow if you're enjoying the stream! }
  halt
}



Basically, what I'm looking to do is make it so when "unknown" users enter the chat it welcomes them once, for the first time and never again (currently 99999999999 seconds, if there's a way to change that let me know please) I would also like a way to turn this on and off. I know an alias is needed so I'll probably have that figured out in a bit after I read more on aliases in the /help files. I would also like a way to make it so if I get "raided" by another streamer it saves the names up for the 10 seconds and welcomes them all at once. Thanks for any help or recommendations smile

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
You shouldn't use goto. What you showed can simply be resolved with simple if statements instead.

Code:
on *:join:#: {
  if ($nick == username1) msg # custom welcome message 
  elseif ($nick == username2) msg # custom welcome message 
  elseif ($nick == username3) msg # custom welcome message
  elseif ($nick == username4) msg # custom welcome message
  elseif ($nick == username5) msg # custom welcome message
  elseif ($nick == username6) msg # custom welcome message
  elseif ($nick == username7) msg # custom welcome message
  else {
    if (%floodwelcome) || ($($+(%,floodwelcome.,$nick),2)) { return }
    set -u10 %floodwelcome On
    set -u99999999999 %floodwelcome. $+ $nick On
    msg # Hey $nick welcome to the stream!! hope you decide to stick around and hangout for a bit, and don't forget to follow if you're enjoying the stream!
  }
}
Just don't make a habit of using goto, it's very unreliable and there are easier ways to do what goto offers anyway.

Personal opinion: I would just make a ini file that stores all user's messages. Would reduce the code length and would offer more convenient edits to it. Want me to show you how it works?


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Thanks Nillen smile Appreciate it. And umm... yeah, because the way I was going to do it with an ini was wrong and no shorter than what you wrote in the long run ha. I really appreciate the help!!

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
on *:join:#: {
  if ($readini(Welcome.ini,Messages,$nick)) msg # $v1
  else { 
    if (%floodwelcome) || ($($+(%,floodwelcome.,$nick),2)) { return }
    set -u10 %floodwelcome On
    set -u99999999999 %floodwelcome. $+ $nick On
    msg # $readini(Welcome.ini,Messages,Unknown)
  }
}
So just create an ini file called Welcome.ini that looks like this:

[Messages]
User1=Hello $nick how are you
User2=...
User3=...
Unknown=...

You make an alias or something to add messages as well, just use
Code:
writeini welcome.ini messages $1 $2-


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Alright, thank you again. Big help, love having shorter scripts and such in my remotes.

So, not to keep you too busy lol, but is there a way to turn this on/off or make it so when multiple users join it'll message them all at once rather than 1 every 10 seconds? If not, I'll live with just this. But If it's possible to do something so when they join it says...

Bot: Welcome to the stream, Unknown1, Unknown2, Unknown3, etc...

?? Like I said, its not super important, would just be nice for raids and such. Or to turn it on/off so when a raid happens it's not flooding my chat and/or missing people.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Forum
That should be what you're looking for.
And you know how to make it on or off if you just think for a second.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Alright, thank you! I'll stick with the what you've given me for now and work with the .timerjoin a bit soon. Thanks again for all the help smile

Joined: May 2014
Posts: 5
H
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
H
Joined: May 2014
Posts: 5
Sorry to borrow the thread, but i can't make this work at all, i did everything written in the thread and when i try to join / leave channels my bot doesn't say anything at all (On twitch)

I tried Nillens .ini thing and still nothing
I just started scripting with mirc yesterday i know how to do all the very basic things..

It works fine with on *:join:#channel: { .msg # $nick -> Joined the channel, welcome! }

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
The ini file worked for me fine. You might need to create the "welcome.ini" file in your mIRC folder. Then just edit it how he posted...

user1=message here
user2=message here

etc, etc...

Joined: May 2014
Posts: 5
H
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
H
Joined: May 2014
Posts: 5
Originally Posted By: Bramzee
The ini file worked for me fine. You might need to create the "welcome.ini" file in your mIRC folder. Then just edit it how he posted...

user1=message here
user2=message here

etc, etc...


I did this, the only change i made is that i called it Regulars.ini but i replaced the name in the script also but not working at all, replaced it like such

mytwitchname=custom message here
user2=message here

So placed Regs.ini @ "C:\Users\Raincloud\AppData\Roaming\mIRC"

With on *:join:mychannel: {
if ($readini(Regs.ini,Messages,$nick)) msg # $v1
else {
if (%floodwelcome) || ($($+(%,floodwelcome.,$nick),2)) { return }
set -u0 %floodwelcome On
set -u0 %floodwelcome. $+ $nick On
msg # $readini(Regs.ini,Messages,Unknown)
}
}

I changed flood while testing

Last edited by Hyuni; 17/05/14 06:50 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Make sure to have a section labeled.

[Messages]
User1=...
User2=...

[Messages] is called a section and is required to know what item you're reading the value from. Syntax: $readini(filename, [np], section, item)


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 5
H
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
H
Joined: May 2014
Posts: 5
Originally Posted By: Nillen
Make sure to have a section labeled.

[Messages]
User1=...
User2=...

[Messages] is called a section and is required to know what item you're reading the value from. Syntax: $readini(filename, [np], section, item)


I did place this inside Regs.ini but doesn't seem to work..
I feel so stupid or did i miss something

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Just making sure now for any possibilities:

Did you literally place this text in your regs.ini?
[Messages]
User1=..
User2=..

Does your event have a # labeled?
on *:join:mychannel: {

try typing this into your chat:
/writeini regs.ini messages testing message thingy now
And see if something looks odd in the file.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 5
H
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
H
Joined: May 2014
Posts: 5
Originally Posted By: Nillen
Just making sure now for any possibilities:

Did you literally place this text in your regs.ini?
[Messages]
User1=..
User2=..

Does your event have a # labeled?
on *:join:mychannel: {

try typing this into your chat:
/writeini regs.ini test testing message thingy now
And see if something looks odd in the file.



I'm so sorry to take ur time, i just realized my own misstake..
I had not put a # inforont of my channel.. Thanks for ur help and patience! (Beginners misstake? >.<)

Last edited by Hyuni; 17/05/14 07:05 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
make it working for multi channel from the start would be better. Just a suggestion wink

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
For myself and my own scripts, I always make it as dynamic as I possibly can. When I don't know how to, I ask someone more experienced. As it should be.

But for others that have questions about these things, it's part of the learning process imo.
6 months ago when I started I knew nothing. I'm still not even remotely close to you guys' levels but at least now I know how to make most stuff I'm desiring, primarily thanks to dissecting the codes I've been provided with and re-designing them myself.

Helping others achieve that is easiest if they realize why the code exactly what they're looking for and fix it themselves.
Everyone has their own rhythm and their own bias when it comes to scripting everything, it's best to let each person discover their own is what I'm trying to get at. Since there are multiple ways of making it multi channel enabled in the first place.

Also, technically it is multi channel enabled, just doesn't offer support for different values per channel.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 5
H
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
H
Joined: May 2014
Posts: 5
I made a ini for each channel, like channel1regs.ini channel2regs.ini i havent for long but it seems to be working! I just have a question how could i add a command like !addreg name msg so it writes a custom msg for that name

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
You need to use an on text event then. Note, you can use the * wildcard in your event, allowing you to use if statements such as "if ($2 == add) ..." etc

When the trigger is made you want to use /writeini to write to the specific section with your item and your value.
Use /help /writeini for reference.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
I just wrote this code, trying to cover up all idea in this thread as much as i can do, but i didnt test it. Hope it works.

!welcome - shows welcome status is on/off
!welcome <on/off> - enables/disables auto welcome.
!welcome reset - removes all unknown users in file, so bot will welcome them again.
!welcome <user> (without msg) - removes custom msg for <user>
!welcome <user> <msg> - adds custom msg for <user>

Note: Only mods can use command.

flood handling: welcomes all unknown users at once if bot got flooded

Code:
on *:TEXT:!welcome *:#:{
  var %file welcome.ini
  if $nick isop # {
    if !$2 { msg # !welcome is $iif($readini(%file,$+(stat.,#),welcome),$v1,on) }
    elseif $2 == on || $2 == off { 
      writeini %file $+(stat.,#) welcome $lower($2) 
      msg # !welcome turned $lower($2)
    }
    elseif $2 == reset {
      remini %file $+(unknown.,#)
      msg # !welcome has been reset.
    }
    elseif !$3 { 
      remini %file $+(vip.,#) $2 
      msg # $2 $+ 's custom message removed.
    }
    else { 
      writeini %file $+(vip.,#) $2 $3- 
      msg # $2 $+ 's custom message added ( $3- )
    }
  }
}

on @!*:JOIN:#:{
  var %file welcome.ini, %stat $iif($readini(%file,$+(stat.,#),welcome),$v1,on)
  if %stat == off { return }
  if $readini(%file,$+(vip.,#),$nick) { msg # $v1 }
  elseif !$readini(%file,$+(unknown.,#),$nick) {
    writeini %file $+(unknown.,#) $nick $ctime
    var %nicks $readini(%file,$+(stat.,#),delay) $nick
    if !%flood.welcome. [ $+ [ # ] ] { 
      msg # Welcome to the stream $replace(%nicks,$chr(32),$+($chr(44),$chr(32))) $+ .
      remini %file $+(stat.,#) delay
      set -u10 %flood.welcome. [ $+ [ # ] ] on
    }
    else { 
      writeini %file $+(stat.,#) delay %nicks 
      $+(.timerwelcome.,#) 1 5 welcome %file # 
    }
  } 
}

alias -l welcome {
  var %nicks $replace($readini($1,$+(stat.,$2),delay),$chr(32),$+($chr(44),$chr(32)))
  if %nicks {
    if $me ison $2 { msg $2 Welcome to the stream %nicks $+ . }
    remini $1 $+(stat.,$2) delay
  }
}

Page 1 of 2 1 2

Link Copied to Clipboard