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
  }
}

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
I'll test now for you man. Appreciate it. Huge help smile

EDIT:
Alright, semi-tested. It works on join, can add and remove, and turn it off and on. The !welcome command (to show if it's on or not) doesn't work for some reason. Not a huge deal though, I believe it's on by default. And it messages when you do !welcome (on/off) so that tells you if it's on anyway. Not able to test for the flood at the moment, but it's blessing so I'm sure that works anyway :P The !welcome reset is also not working, for me at least. But, I'll try to sort it out a bit smile

Also, if you have an old welcome script, you'll need to re-do all the welcome messages (I just copy/pasted them from the old one under the new [vip.#channelnamehere] in the welcome file. Thanks again bless!


EDIT2:

After a little more testing, I think I've found the problem. When I do "!welcome on/off" it messes something up. After turning it on and not leaving it on by default it stops letting me edit messages, removing messages, and resetting unknown. Which is fine, for me anyway, since I don't mind going in and taking it out when I need to. Again, thank you blessing.

Last edited by Bramzee; 18/05/14 08:47 PM.
Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
I expanded on this a little wink

Someone says "!welcome [message]" and it sets that to be their join message. When they enter it will be that message laugh

The $read(sreglist.txt,nw,$nick) is my list of nicknames that i want to have a join message (so it's not spammy)you can easily replace it with if ($nick isop $chan) {

Code:
on *:join:#: { if ($readini(Welcome.ini,Messages,$nick)) msg # $v1 }
on *:TEXT:!welcome *:#: {
  if ($read(sreglist.txt,nw,$nick)) {
    if ($readini(Welcome.ini,Messages,$nick)) {
      remini Welcome.ini Messages $nick
      msg # changed $nick $+ 's welcome message to " $+ $2- $+ "
      .timerWriteWelcomeMessage 1 1 writeini Welcome.ini Messages $nick $2-
    }
    else {
      msg # set $nick $+ 's welcome message to " $+ $2- $+ "
      writeini Welcome.ini Messages $nick $2-
    }
  }
}



#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Never use a timer with user input without the safe alias, not that you should be using a timer here at all anyway. And always use the "n" switch for both $read and $readini. You also don't need to remini if you're going to writeini afterward.

Code:
on *:join:#: { if ($readini(Welcome.ini,n,Messages,$nick)) msg # $v1 }

on *:text:!welcome *:#: {
  if ($read(sreglist.txt,nw,$nick)) {
    if ($readini(Welcome.ini,n,Messages,$nick)) {
      msg # changed $nick $+ 's welcome message to " $+ $2- $+ "
    }
    else {
      msg # set $nick $+ 's welcome message to " $+ $2- $+ "
    }
    writeini Welcome.ini Messages $nick $2-
  }
}

alias safe return $!decode( $encode($1,m) ,m)

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Thanks for helping testing it. Do appreciate. smile
!welcome doesn't work but !welcome reset works, for me.

changes:
* Added code that allows vip user (that already in the file) to change their own custom msg (idea from judge2020)
usage: `welcome <msg>
Note:
- command only can be triggered when !welcome is on
- it has floodcontrol 10secs

* added n switch for $readini. forgot about that. thanks to Loki.

Code:
on $*:TEXT:/^[!`]welcome/iS:#:{
  var %file welcome.ini, %stat $iif($readini(%file,n,$+(stat.,#),welcome),$v1,on)
  if $1 == !welcome && $nick isop # {
    if !$2 { msg # !welcome is %stat }
    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 { 
      var %m $readini(%file,n,$+(vip.,#),$2)
      writeini %file $+(vip.,#) $2 $3-
      remini %file $+(unknown.,#) $2 
      msg # $2 $+ 's custom message $iif(%m,changed,added) ( $3- )
    }
  }
  elseif $1 == `welcome && %stat == on && $readini(%file,n,$+(vip.,#),$nick) && !%flood.welcome. [ $+ [ $+(#,.,$nick) ] ] {
    writeini %file $+(vip.,#) $nick $2-
    msg # $nick $+ 's custom message changed ( $2- )
    set -u10 %flood.welcome. [ $+ [ $+(#,.,$nick) ] ] on
  }
}

on @!*:JOIN:#:{
  var %file welcome.ini, %stat $iif($readini(%file,n,$+(stat.,#),welcome),$v1,on)
  if %stat == off { return }
  if $readini(%file,n,$+(vip.,#),$nick) { msg # $v1 }
  elseif !$readini(%file,n,$+(unknown.,#),$nick) {
    writeini %file $+(unknown.,#) $nick $ctime
    var %nicks $addtok($readini(%file,n,$+(stat.,#),delay),$nick,32)
    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
  }
}




Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Somehow I've missed the last few posts in here. However, I appreciate the help. the ability for regs to set their own message is awesome and was something I did on my own, but your way is definitely cleaner and more reliable ha. I'll add it in as soon as I'm home and back on my computer. Thanks again guys.

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
So, not to dig up old threads... But, I got a small "mini-raid" the other day. The messages weren't popping up for people when more than one joined. It would welcome just one, and then ignore the rest for a little bit and welcome the next person that joined. Sorry if this is what is supposed to happen, and I just mis-read the post. But, as far as I could tell it was supposed to welcome multiple users at the same time? I tried looking through it after my stream was over but at that point I was exhausted and just couldn't. I just got back from my sisters grad party and figured I'd stop in here for some help before my stream tonight. Thanks <3

Page 1 of 2 1 2

Link Copied to Clipboard