mIRC Home    About    Download    Register    News    Help

Print Thread
#88667 30/06/04 02:20 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
My first post on mirc home! I have a few years 'hands-on' with mIRC but one task has evaded me.

Is it possible to create a script or alternative to auto input a random line from a text file? So far I have only managed to find 'random insult' a bit of fun that chooses a random insult from a list, but it requires a slap! Is it possible to auto-input say every 5 seconds a different line from a file into the main channel window? How can this be done? I have been unable to find any information so far (unless looking at this completely wrong!) Thanks.


'Everyone is entitled to my opinion!'
#88668 30/06/04 03:17 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
$read(file.txt) reads a random line from file.txt

if you want to do something every five seconds you can use a /timer.
For example: /timer 0 60 /msg #channel Hi there, this will bug you every minute! would annoy people every minute with a message... The 0 stands for always, if you make it 1 it will only do this once and then stop.

#88669 01/07/04 03:29 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
Hey thanks. I understand the script looking at it now but can't get it to work. Where do I put this and how do I call it if I even need to! I figured it was an alias script as it is a repititous task but it does'nt run? I usually join 3 channels and would like to auto-text all three, hence automating the input or I will be typing for hours! grin


'Everyone is entitled to my opinion!'
#88670 01/07/04 09:10 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
I meant to add that I have also tried this in the 'perfom' section but it cannot write to channel. Also when I typed in the command:

/timer 0 8 /msg #channel $read(file.txt)

The result I got in the channel was:

#channel-> text
not
<my nick>'My Text'

I am missing something very simple here I know but can't figure it out. I just want to automatically 'speak' (input) from a text file on each channel I am on. Thanks. confused


'Everyone is entitled to my opinion!'
#88671 01/07/04 09:36 PM
Joined: Jun 2004
Posts: 133
S
Vogon poet
Offline
Vogon poet
S
Joined: Jun 2004
Posts: 133
what i believe you want is

/timertest 0 60 msg #channel $chr(60) $+ $me $+ $chr(62) $read(filename.txt)

to output <smudge> your text shows here
every 60 seconds

ScoT
#mIRC Undernet


Give a man a fish feed him for a day, Teach him to fish, feed him for life
#88672 01/07/04 10:47 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
Thanks ScoT. I still can't make this work tho. I put this [/timertest 0 60 msg #channel $chr(60) $+ $me $+ $chr(62) $read(filename.txt)] in 'Perform on connect' and in the channel window I get:

'0 Unknown command'

Do I put this in aliases?


'Everyone is entitled to my opinion!'
#88673 01/07/04 11:07 PM
Joined: Jun 2004
Posts: 133
S
Vogon poet
Offline
Vogon poet
S
Joined: Jun 2004
Posts: 133
hmm i could be wrong but i heard there can be problems starting certain commands from timers from perform.. as a workaround i'd try this
put this in perform
timerthing 0 60 thing

then in remotes alt+r we can create an alias such as

alias thing msg #channel $chr(60) $+ $me $+ $chr(62) $read(filename.txt)

2 points (sorry if i sound patronising) but you must change #channel to a channel you are in, and your file.txt..or filename.txt Must be in $mircdir main mirc folder for example C:\mirc or supply the full path to it after $read

ScoT
#mIRC Undernet


Give a man a fish feed him for a day, Teach him to fish, feed him for life
#88674 01/07/04 11:37 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
Thank you ScoT. The server window is running as timed, but I am getting:

#channel* <nick> my text

#channel Cannot send to channel

If I am not mistaken this is a setting in general options to be disabled/enabled isn't it? I can't find it tho. Any help appreciated. Thankx


'Everyone is entitled to my opinion!'
#88675 01/07/04 11:48 PM
Joined: Jun 2004
Posts: 133
S
Vogon poet
Offline
Vogon poet
S
Joined: Jun 2004
Posts: 133
ok i added to my perform on connect section
for Undernet only

timerthing 0 60 thing
join #scot2

and in a clean remote file i added

alias thing msg #scot2 $chr(60) $+ $me $+ $chr(62) $read(versions.txt)

* Now talking in #scot2
<ScoT> <ScoT> was reached, and 0 = error accessing file.
<ScoT> <ScoT> 34.An error message is now displayed when the maximum recursion

the timer works fine, are you joining the channel ??

ScoT
#mIRC Undernet


Give a man a fish feed him for a day, Teach him to fish, feed him for life
#88676 02/07/04 03:25 AM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
That last trick is working which is great. However I still need a little fine tuning if you have any other ideas?

From the 'perform on connect' and Remotes I get:

*Timer thing activated

Then in the first channel window the timer begins but with a 'typo' as the message doesn't come out right:

<my nick> my nick> "Line from Text"

It doubles my nick to include the non-printing achii character. The other snag is that

*Timer thing activated

does not work in another channel window on the same server (such as Quakenet) at the smae time, as I need to $read into 3 channels. Do I have to edit remotes or can I load it new in each channel window? I do appreciate your help. This has been bugging me for ages and I feel I'm getting somewhere now! smile


'Everyone is entitled to my opinion!'
#88677 02/07/04 12:32 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
//timerspam 0 60 msg #channel $!read(filename.txt)

Be sure to replace #channel with the actual channel you want to send it to. The ! stops the evaluation the first time, so that the timer reads a new random line each time, and not repeat the same line that was read when you started the timer over and over.

If you type it from the editbox in your channel, use // at the start to make it evaluate it like in a script. If you only use / then you should also remove the !... You can use /timerspam stop to stop the timer.

If you want it to run each time you join that channel, you can put this in your remote (alt-r tab Remote). Make sure there are 2 lines in your script, each one starting with "on", not one long, it will not work.

on *:JOIN:#channel:if ($nick == $me) .timerspam 0 60 msg #channel $!read(filename.txt)
on *:PART:#channel: .timerspam stop

The . means that the * Timer spam started will not be displayed.
The on PART event makes sure the timer stops when you leave the channel.

#88678 02/07/04 02:30 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
Thanks for that. That really works effectively in the first channel. I tried 'doubling' this in remotes so it would work in a second but no joy yet. Can it 'load' automatically or should I just call it as a script?

on *:JOIN:# channel_01 :if ($nick == $me) .timerspam 0 60 msg #channel_01 $!read(text.txt)
on *:PART:#channel_01: .timerspam stop
on *:JOIN:# channel_02:if ($nick == $me) .timerspam 0 60 msg #channel_02 $!read(text.txt)
on *:PART:#channel_02: .timerspam stop

Also when I did 'call' it as a script, it wasn't formatted like the first channel. It was similar to the above post:

<my nick> my nick> "Line from Text"

The first channel works a dream tho!..

Thanks again. (I was also reading about 'play' with a timer but this seems to work very well).


'Everyone is entitled to my opinion!'
#88679 02/07/04 06:28 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

you can put multiple channels in events.

Example: on *:JOIN:#channel1,#channel1,#channel3: do stuff

Greets



Gone.
#88680 02/07/04 08:26 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
Thanks guys. So far I have this in remotes:

on *:JOIN:#channel_01,#channel_02:if ($nick == $me) .timerspam 0 60 msg #channel_01,#channel_02 $!read(text.txt)
on *:PART#channel_01,#channel_02: .timerspam stop


Hoping to $read into each channel. Instead I now get this error:

->*#channel_01,#channel_02* mytextline
#channel_01 Cannot send to channel


The remotes idea before worked well but only on one channel. What am I doing wrong? (Yeah don't say it!) wink

By the way, if I type:

/timerspam 0 60 msg #channel_01 $read(text.txt)
Into 'Channel_01' this activates the script in this window,

/timerspam 0 60 msg #channel_02 $read(text.txt)

works in this channel and so on. I guess I'm trying to run all this on connect rather than remotes starting in ONE channel and no other OR having to type this in each channel. Make sense? Thanks.


'Everyone is entitled to my opinion!'
#88681 03/07/04 04:59 PM
Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
using /timerspam will reset it every time it's used (and only for the last channel it's used on).

/timer $+ #channel_01 0 60 msg #channel_01 $read(text.txt)

/timer $+ #channel_02 0 60 msg #channel_02 $read(text.txt)


I refuse to engage in a battle of wits with an unarmed person. wink
#88682 03/07/04 07:39 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
Hmm..

If I call this script,

/timer $+ #channel_01 0 8 msg #channel_01 $read(text.txt)

In the channel I get:

*/timer: invalid parameters

and in the server window I get:

*/msg: insufficient parameters

confused


'Everyone is entitled to my opinion!'
#88683 03/07/04 09:16 PM
Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
um .. did you change #channel_01 to a real channel name?


I refuse to engage in a battle of wits with an unarmed person. wink
#88684 03/07/04 09:56 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
Yes I did! lol.

I understand what you were saying about timing out tho. The other script works, but it does time out after a few mins. Your code on the other hand I can't get to work?!? confused

Called as a script or in remotes?


'Everyone is entitled to my opinion!'
#88685 04/07/04 05:59 PM
Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
I assumed you were starting it from a remote script or popup .. from the command prompt, use //timer#channel_01 0 60 msg #channel_01 $read(text.txt)


I refuse to engage in a battle of wits with an unarmed person. wink
#88686 05/07/04 12:17 PM
Joined: Jun 2004
Posts: 11
S
smudge Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2004
Posts: 11
Thanks! That works very well. I had to change it a bit but what worked well was:

//timer $+ #channel_01 0 60 msg #channel_01 $!read(text.txt)

If I left out the '!' then the same line was being repeated and if I left out the $+ then I ws getting 'insufficient parameters'. Thanks for all the help guys.


'Everyone is entitled to my opinion!'

Link Copied to Clipboard