mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#253718 29/06/15 02:32 PM
P
powerade661
powerade661
P
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.
#253721 29/06/15 03:36 PM
Joined: Dec 2013
Posts: 771
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 771
Look at line 2 and tell me if you see anything wrong.

P
powerade661
powerade661
P
Wow Nillen I feel really dumb now... I got it, thanks for pointing it out. smile

#253724 29/06/15 05:38 PM
P
powerade661
powerade661
P
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.
#253726 29/06/15 06:16 PM
Joined: Jan 2004
Posts: 1,330
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,330
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.

P
powerade661
powerade661
P
How would I write the .ini files for each channel that executes the command?

#253775 05/07/15 06:47 PM
P
powerade661
powerade661
P
Any ideas?

#253776 05/07/15 06:52 PM
P
powerade661
powerade661
P
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

#253777 06/07/15 12:29 AM
B
Belhifet
Belhifet
B
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

#253781 06/07/15 01:45 PM
P
powerade661
powerade661
P
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
  }
}

#253782 06/07/15 01:59 PM
P
powerade661
powerade661
P
Ok this works. Has anyone figured out how to do a timer command to create timers?

Regards,
Powerade661

#253784 06/07/15 04:04 PM
P
powerade661
powerade661
P
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.
#253786 06/07/15 05:15 PM
S
Sakana
Sakana
S
try inserting this line

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

#253787 06/07/15 05:21 PM
P
powerade661
powerade661
P
Never mind

Last edited by powerade661; 06/07/15 05:25 PM.
#253788 06/07/15 05:24 PM
P
powerade661
powerade661
P
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.
#253789 06/07/15 06:59 PM
S
Sakana
Sakana
S
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-

}

#253791 06/07/15 09:02 PM
P
powerade661
powerade661
P
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.
#253792 06/07/15 09:12 PM
P
powerade661
powerade661
P
How would I stop this timer? is it just named timer or is the channelname the timer's name?

Regards,
Powerade661

#253793 06/07/15 09:40 PM
Joined: Dec 2013
Posts: 771
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 771
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.

P
powerade661
powerade661
P
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

Link Copied to Clipboard