mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Need help with this. #253718 29/06/15 02:32 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
So basically I have been playing around trying to get this to work and would like to know if this is possible. I am trying to make it so that if someone is new in the chat, it welcomes them when they say something in the chat. If they are not new it welcomes them back.

I found this script on the forums, but I am trying to make it do something else instead. Currently it only works if they join and say something but I want to make so that if they say anything in the chat and they are new it welcomes them. Below is the code.

Example of what I am trying to do
Code:
 on *:text:#channel1: {
    if (!$read(joins.txt,nw,$nick)) {
      msg $chan Welcome to the stream $nick $+ . 
      write joins.txt $nick
    }
    else { msg $chan Welcome back $nick $+ . }
  }




Code:

on *:JOIN:#channel1: {
  on *:text:*: {
    if (!$read(joins.txt,nw,$nick)) {
      msg $chan Welcome to the stream $nick $+ . 
      write joins.txt $nick
    }
    else { msg $chan Welcome back $nick $+ . }
  }





Thanks,
Powerade661

Last edited by powerade661; 29/06/15 02:57 PM.
Re: Need help with this. [Re: powerade661] #253721 29/06/15 03:36 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Look at line 2 and tell me if you see anything wrong.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Need help with this. [Re: Nillen] #253723 29/06/15 05:14 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Wow Nillen I feel really dumb now... I got it, thanks for pointing it out. smile

Re: Need help with this. [Re: powerade661] #253724 29/06/15 05:38 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
How would I put this in a command for multiple channels just out of curiosity? So instead of doing on *:text:*:#channel1:{ I could just do !welcome on and it would write the channel along with the user. And it would generate different text files for each channel. Is this possible? So for example it would put this in a text file and of course it would look for each channel for those users and if not it would welcome them.

Channel1.txt would contain
Code:
bots
potato
cloud
moose



Channel2.txt would contain
Code:
coder123
yoyo2
potato5 



How would I do this?

Last edited by powerade661; 29/06/15 05:41 PM.
Re: Need help with this. [Re: powerade661] #253726 29/06/15 06:16 PM
Joined: Jan 2004
Posts: 1,352
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,352
I would suggest using ini files over text files, ini files are implemented internally as hash tables so their performance should be nearly the same (and much better than using $read(,nw)).

In this way you can have a single file with multiple sections and users.

activity.ini:
Code:
[#chan1]
nick1=1
nick2=1
nick3=1

[#chan2]
nick4=1
nick5=1
nick6=1


Then you use $readini(activity.ini,n,$chan,$nick) to access that information. Instead of storing just a "1" you could store other information like last join time to use for limiting when you welcome them.

Re: Need help with this. [Re: Loki12583] #253733 30/06/15 02:43 AM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
How would I write the .ini files for each channel that executes the command?

Re: Need help with this. [Re: powerade661] #253775 05/07/15 06:47 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Any ideas?

Re: Need help with this. [Re: powerade661] #253776 05/07/15 06:52 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Also I have been wondering is it possible to have a timer command such as !timer #channel 30 This is my timer message.

Regards,
Powerade661

Re: Need help with this. [Re: powerade661] #253777 06/07/15 12:29 AM
Joined: Jun 2014
Posts: 248
B
Belhifet Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Originally Posted By: powerade661
How would I write the .ini files for each channel that executes the command?


/writeini <inifile> <section> <item> <value>

/writeini activity.ini $chan $nick $ctime

Re: Need help with this. [Re: Belhifet] #253781 06/07/15 01:45 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Would this be right?

Code:
on *:text:*:#:{
  if (!$readini(activity.ini,n,$chan,$nick) {
    msg $chan Welcome to the stream $nick $+ !
    /writeini activity.ini $chan $nick $ctime
  }
}

Re: Need help with this. [Re: powerade661] #253782 06/07/15 01:59 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Ok this works. Has anyone figured out how to do a timer command to create timers?

Regards,
Powerade661

Re: Need help with this. [Re: powerade661] #253784 06/07/15 04:04 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
How would I make the script do nothing if the streamer was to type something in the chat?

Code:

on *:text:*:#:{
  if !$readini(activity.ini,n,$chan,$nick) {
    msg $chan /me Welcome to the stream $nick $+ ! :)
    /writeini activity.ini $chan $nick $ctime
  }
  elseif (# = #) { return }

}




Last edited by powerade661; 06/07/15 04:05 PM.
Re: Need help with this. [Re: powerade661] #253786 06/07/15 05:15 PM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
try inserting this line

Code:
if ($nick == $remove(#,$chr(35))) { return }

Re: Need help with this. [Re: Sakana] #253787 06/07/15 05:21 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Never mind

Last edited by powerade661; 06/07/15 05:25 PM.
Re: Need help with this. [Re: powerade661] #253788 06/07/15 05:24 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
That worked! Thanks so much! What exactly is going on here? Can you explain it to me? Also how would I make a command that can create timers?
Example: !addtimer #channel1 30 This is my timer

Last edited by powerade661; 06/07/15 05:28 PM.
Re: Need help with this. [Re: powerade661] #253789 06/07/15 06:59 PM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
It just checks if the nick is the name of the channel (without the #) -- so that's the same as the streamer's nick

A basic command to add timers could be this, but you need some IF statements because as is it would be abusable


Code:
on *:text:!addtimer *:#:{

.timer 0 $calc($3 * 60) msg $2 $4-

}

Re: Need help with this. [Re: Sakana] #253791 06/07/15 09:02 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Is this what you are referring to when you are talking about IF statements?

Code:
on *:text:!addtimer *:#:{
if ($nick isop #) {
.timer 0 $calc($3 * 60) msg $2 $4-

}
}


Last edited by powerade661; 06/07/15 09:03 PM.
Re: Need help with this. [Re: powerade661] #253792 06/07/15 09:12 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
How would I stop this timer? is it just named timer or is the channelname the timer's name?

Regards,
Powerade661

Re: Need help with this. [Re: powerade661] #253793 06/07/15 09:40 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
You could try figuring it out yourself. /Help timers

As mentioned in that, your timer would be timer1 assuming there were no previous timers active. If you want to bypass this unexpected number behaviour you could edit your own script to begin with.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Need help with this. [Re: Nillen] #253794 06/07/15 10:03 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
That's just the thing, there are tons of timers running. /timer1 off is generally how you would normally turn off the timer if the timer was timer1, I just don't know what this timer is named. That's why I asked.

Page 1 of 2 1 2