mIRC Home    About    Download    Register    News    Help

Print Thread
#155732 08/08/06 10:35 PM
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
Hey! I am asking a really big favour here. grin

I have searched the net many times for this, and can only find no-usable-for my purpose stuff, of stuff for bots.

So the thing is.

I got like 340 lines of personal written “one liners” in a text file. I edit all the time via the F8 key. (Opening a notepad by the /run command.) BTW: I may have exaggerated a bit when saying the number of lines, but I won’t count them. Heh…;)

If I put all the “quotes”, all neatly in order, line by line, in a “quotes.txt” in the mIRC folder, …

Then if I wanted to display a random quote, in a dead silent channel E.g.
I could type !quote , either in a channel or in a personal-message.
Subsequently triggering; <my-nick> “random Quote” …

It sounds simple, but I do not manage to figure this one out.

And, now that I ask you.

And if anyone got the time and find pleasure in doing this for me. (and others who might like it?)
I would also like for “me acting as a bot”, to be able to do this:

If someone type !add quote “the quote”, to me in personal-message, or in main chat.
(Either it is their own, or by others.)
Then it would be added to “quotes.txt”. [Which I of course then could edit with easy ever day.]

To protect against abuse, it would be cool to be able to “ban” certain nicknames, by the right click menu. From adding any quotes. (Then ignoring from that nickname until I delete it from a list, of some kind or how one may do it?) : )

So, if I imagine having this thus far, I can type !quote, and other can type !quote, to get me to say a “random quote” … so what came to mind then, is that there should be a delay to how many “random quote” I will answer in so many minutes. Say max òne each hour. Or, a random delay with in 10 - 90minutes, or so? Side note: It would be nice to have the delay no be relevant in the personal-message windows, but unlimited there?)

An other function that would be neat, would be; !quote “number” ..
Say all the lines in the quote.txt get a number on adding, or when I type manually by the F8, adding a new to the .txt. wink

So I think that would be it.


I imagine it done to test for ideas once again:

I and others, can use: !quote to display a quote, (and it is randomly delayed so no spamming should occur.)
I and others, can use: !quote “number” to display a selected One liner.

I and others, can use: !add quote “quote”, to add a quote.
I can right-click on the names of anyone I want to not be ale to use the !add quote feature, and “ban” them from ever doing that with that nick. (so that I still see what the nick say, but won't reply to any off the commands, but the !quote, and !quote "number".)
If I wanted to disable the script, I could do that to? Even in specific channels? (Some might be bothered by use of this feature, even though there is so many lines that it won’t get repetitive, .. and is growing ‘each day’. (and the random delay)

Anyone up for the scripting?
I can only be thankful by words, and in spirit, though…
Thank you for reading my request!
And have a fine, fine day! laugh

Last edited by gomp; 08/08/06 10:47 PM.

I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Alright, you really shouldn't bother with typing !quote, in a window and then doing the quote.

You can use an alias called "aquote" instead.

/aquote <channel or nick> would message the channel or nick with the quote, if you specify neither channel or nick, it will simply "echo" the quote to your window (so you're the only person that reads it).

Code:
alias aquote { $iif($1,msg $1,echo -ag) $read(quote.txt) }


Now, if you're still not satisfied, and absolutely MUST message the channel or nick with "!quote."

Code:
alias aquote { $iif($1,msg $1,echo -ag) $read(quote.txt) }
on *:signal:givequote:{ aquote $1 }
on *:input:*:{ 
  if ($1- == !quote &amp;&amp; $window($active).type isin query.channel) {
    .signal givequote $active
  } 
}
on *:text:!quote:*:{ 
  if (!%quote.flood.prot. [ $+ [ $wildsite ] ]) {
    aquote $iif($chan,$chan,$nick)
    set -z %quote.flood.prot. [ $+ [ $wildsite ] ] 10 
  }
}


/aquote <#channel or nick>; Messages the quote to a chan or nick.
/aquote; Echo's the quote to your active window.
!quote; in a query or channel window, will message the quote after.

Someone typing "!quote" in channel or PM will send them a quote. (I added an additional 10 second delay for this, just as a safety precaution)

Note: In case someone attempts to correct my script, there is a reason I'm using a signal and not a timer. 1.) double evaluations can lead to problems. (yes this can be avoided, but why bother when you can use a signal), 2.) We want the quote to be sent after !quote.

That second reason can be done with haltdef, and messaging both !quote and the quote to the channel, but here's the thing: Doing that may lead to problems with -other- on input scripts (for example, themes), so we're staying away from that problem by doing it this way.

Enjoy.

Edit: Oops, had a [./quote.] instead of a [./code.]

Last edited by Rand; 09/08/06 12:49 AM.
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
you're not asking that much really, and I bet you could code most of it yourself, but how does this look...

Code:
;!Quotescript

menu nicklist {
  !Quote Script
  .Ban/Unban $1 : qsban $$1
}
alias -l qsban {
  if $eval(% $+ qs. $+ $1 , 4 ) { 
    unset %qs. $+ $1
    echo -a $1 Removed from ban list
  }
  else { 
    set %qs. $+ $1 $true
    echo -a $1 Added to ban list
  }
}

on 1:text:*:#channel:{
  if !$eval(% $+ qs. $+ $1 , 4 ) { 
    if ( !quote isin $1 ) &amp;&amp; ( $2 isnum ) { qsquote $2 }
    elseif ( !quote isin $1 ) &amp;&amp; ( !$2 ) { qsrandom }
    elseif ( !add isin $1 ) { qsaddquote $2- }
  }
  else .notice $nick You can't do this coz you are BANNED!
}
on 1:input:#channel:{
  if ( !quote isin $1 ) &amp;&amp; ( $2 isnum ) { qsquote $2 }
  elseif ( !quote isin $1 ) &amp;&amp; ( !$2 ) { qsrandom }
  elseif ( !add isin $1 ) { qsaddquote $2- }
}

alias -l qsquote {
  msg #channel 8,1QUOTE1,8 $read(quotes.txt,$1)
}
alias -l qsrandom {
  msg #channel 8,1QUOTE1,8 $read(quotes.txt)
}
alias -l qsaddquote {
  write quotes.txt $1-
}



i havent put any timers in though. i'm sure others will change this about anyhow :tongue:

Last edited by billythekid; 09/08/06 12:55 AM.

billythekid
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
Quote:
Alright, you really shouldn't bother with typing !quote, in a window and then doing the quote.

You can use an alias called "aquote" instead.

/aquote <channel or nick> would message the channel or nick with the quote, if you specify neither channel or nick, it will simply "echo" the quote to your window (so you're the only person that reads it).

Code:
alias aquote { $iif($1,msg $1,echo -ag) $read(quote.txt) }


Now, if you're still not satisfied, and absolutely MUST message the channel or nick with "!quote."

Code:
alias aquote { $iif($1,msg $1,echo -ag) $read(quote.txt) }
on *:signal:givequote:{ aquote $1 }
on *:input:*:{ 
  if ($1- == !quote &amp;&amp; $window($active).type isin query.channel) {
    .signal givequote $active
  } 
}
on *:text:!quote:*:{ 
  if (!%quote.flood.prot. [ $+ [ $wildsite ] ]) {
    aquote $iif($chan,$chan,$nick)
    set -z %quote.flood.prot. [ $+ [ $wildsite ] ] 10 
  }
}


/aquote <#channel or nick>; Messages the quote to a chan or nick.
/aquote; Echo's the quote to your active window.
!quote; in a query or channel window, will message the quote after.

Someone typing "!quote" in channel or PM will send them a quote. (I added an additional 10 second delay for this, just as a safety precaution)

Note: In case someone attempts to correct my script, there is a reason I'm using a signal and not a timer. 1.) double evaluations can lead to problems. (yes this can be avoided, but why bother when you can use a signal), 2.) We want the quote to be sent after !quote.

That second reason can be done with haltdef, and messaging both !quote and the quote to the channel, but here's the thing: Doing that may lead to problems with -other- on input scripts (for example, themes), so we're staying away from that problem by doing it this way.

Enjoy.

Edit: Oops, had a [./quote.] instead of a [./code.]



Maybe I am misunderstand it, but that script does not do half of what I look for..


Thank you anways!


smile

Last edited by gomp; 09/08/06 08:19 AM.

I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
Quote:
you're not asking that much really, and I bet you could code most of it yourself, but how does this look...

Code:
;!Quotescript

menu nicklist {
  !Quote Script
  .Ban/Unban $1 : qsban $$1
}
alias -l qsban {
  if $eval(% $+ qs. $+ $1 , 4 ) { 
    unset %qs. $+ $1
    echo -a $1 Removed from ban list
  }
  else { 
    set %qs. $+ $1 $true
    echo -a $1 Added to ban list
  }
}

on 1:text:*:#channel:{
  if !$eval(% $+ qs. $+ $1 , 4 ) { 
    if ( !quote isin $1 ) &amp;&amp; ( $2 isnum ) { qsquote $2 }
    elseif ( !quote isin $1 ) &amp;&amp; ( !$2 ) { qsrandom }
    elseif ( !add isin $1 ) { qsaddquote $2- }
  }
  else .notice $nick You can't do this coz you are BANNED!
}
on 1:input:#channel:{
  if ( !quote isin $1 ) &amp;&amp; ( $2 isnum ) { qsquote $2 }
  elseif ( !quote isin $1 ) &amp;&amp; ( !$2 ) { qsrandom }
  elseif ( !add isin $1 ) { qsaddquote $2- }
}

alias -l qsquote {
  msg #channel 8,1QUOTE1,8 $read(quotes.txt,$1)
}
alias -l qsrandom {
  msg #channel 8,1QUOTE1,8 $read(quotes.txt)
}
alias -l qsaddquote {
  write quotes.txt $1-
}



i havent put any timers in though. i'm sure others will change this about anyhow :tongue:



Woah!

That looks like what I am after, or atleas a start!

Thank you ever so much!

I am drunk now, but will play with this as soon as I sober up1

Thank you so much for readign my post, and doing that for me!
I salute you! laugh


I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
I am just lookign over this..

I swirl in my head, (am drunk). So I wont try this tody..
But, I ask..

(As I cannot find it in the script.)

What is the !add quote, command? is it !add?
What is the !quote "number", command? could not find any..
And the !quote, command, I think I found!

Thank you!

I cannot code.

But, now I got soemthignt o workc with and ask abotu, at least! smile


I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
1) !add "quote" is !add
2) !quote <number> is !quote <number>
3) !quote is !quote

Billy combined the different options into one ON TEXT event with a single wildcard, rather than having 3 ON TEXT events.

Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
I try/tried to type this slow, So no errors..

What I am asking, is..

Could you explain in short, how to use that script, and compare it to what I "imagined int he frist post"..

I really think I am askign a lot here.

I wish someone would go through my first post here, and compleate it step by step.

I guess I shoudl learn to script, but there might we a willign soul out there! and you sur made a fine start, and If I missunderstand, then you might have een made it aldread! God bless beer!

Thank you for hwlping me out!

Last edited by gomp; 09/08/06 08:44 AM.

I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
Thank you!

I guess this will be really fun to fiddle with later!

MAyeb I can even learn to make the delays/timers limits thing msyelf!

Scripting is so fun!

All the posibilites, and all the ideas! Woah!

grin


I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Recommendation: Go to bed and sleep off your intoxication.
The code will read better when you're not drunk.

Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
I am insomniac..
But, thank you for advice! I will do that indeed...

You hit the nail ont he ehad, I been up for 24 hours + + do not even keep count anymore..

I just ask this;
(And come back in the morning..)
Would the quotes.txt file, look like this:

1"Everything can contain nothing.. but nothing cannot contain everything.. Thus, nothing becomes, what it already is.."
2"We need no religion, as we are; A legion!"
3"The Truth is relative to its context."
4"Never doubt your doubts!"
5"I neither agree nor dis-agree, I keep open, and let be!"
6"Do what has been done.. in doing it/so!"
7"A-live ..Dead & Birthing!" ...

.. ?

Or with a 1 "You alone, are; what we -is- together..

Like.. with a space, or just in block?

Thank you so much for helping me out, I feel like a kid in a kindergarden, souroanded by loving adults!

laugh

Last edited by gomp; 09/08/06 08:57 AM.

I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
Please consider the above post, as I have tried both with 1 "the text .. . .
and with 1"the text...

Maybe I am doing something wrong there?


Anyways, here is a logg from my testing:

Seems only the "ban un ban" thing is working..



Start of #shamanism buffer: Thu Aug 10 17:52:48 2006

13:52:09 * Now talking in #shamanism
13:52:09 * Topic is '"Imagine it.. Realize it.. Be it!" http://youtube.com/watch?v=UnY3xPJRcoI'
13:52:09 * Set by tripper!~snik@ti211110a080-7214.bb.online.no on Wed Aug 09 18:43:19
13:53:55 * Quits: curious (Ping timeout: 504 seconds)
13:54:00 * Gomp is now known as curious
14:12:40 * Joins: tripper
14:38:00 <13tripper> And know that if I knew
14:38:00 <13tripper> all of the answers I would
14:38:00 <13tripper> not hold them from you'd
14:38:00 <13tripper> know all of the things that i'd know 'cause
14:38:00 <13tripper> we told each other, there is no other way
15:42:40 <lyd> philosophy
15:43:02 <lyd> hehe var det rikti skrivd ?
15:43:08 <lyd> tripper
15:43:23 * lyd slaps tripper around a bit with a large trout
15:43:55 * lyd sets mode: +ooo curious h4x0r3d heliacal
15:44:01 * lyd sets mode: +ooo hoyball Jordan0 tripper
15:44:07 * lyd sets mode: +o unsecured
15:44:11 <lyd> :P
16:03:17 <curious> :)
16:27:30 <13tripper> lyd: jau
16:27:46 <lyd> kult laugh
16:28:00 <13tripper> np: jack johnson - no other way wink
16:57:04 <curious> 1Now Playing: Jack Johnson - Good People
17:16:57 * Quits: hoyball (omstøvel)
17:50:10 <curious> !quote
curious Added to ban list
curious Removed from ban list
17:51:17 <curious> !add Tell me all I know, and you will too!
17:51:48 <curious> !qoute 1
17:51:52 <curious> !Qoute 1
17:52:10 <curious> !Qoute 1
17:52:16 <curious> !quote
End of #shamanism buffer Thu Aug 10 17:52:48 2006


My alias is as follows:

I removed the other to not show passwords etceter..

but this is the bottom..

;
; - !Quotescript...
;



menu nicklist {
!Quote Script
.Ban/Unban $1 : qsban $$1
}
alias -l qsban {
if $eval(% $+ qs. $+ $1 , 4 ) {
unset %qs. $+ $1
echo -a $1 Removed from ban list
}
else {
set %qs. $+ $1 $true
echo -a $1 Added to ban list
}
}

on 1:text:*:#channel:{
if !$eval(% $+ qs. $+ $1 , 4 ) {
if ( !quote isin $1 ) && ( $2 isnum ) { qsquote $2 }
elseif ( !quote isin $1 ) && ( !$2 ) { qsrandom }
elseif ( !add isin $1 ) { qsaddquote $2- }
}
else .notice $nick You can't do this coz you are BANNED!
}
on 1:input:#channel:{
if ( !quote isin $1 ) && ( $2 isnum ) { qsquote $2 }
elseif ( !quote isin $1 ) && ( !$2 ) { qsrandom }
elseif ( !add isin $1 ) { qsaddquote $2- }
}

alias -l qsquote {
msg #channel 8,1QUOTE1,8 $read(quotes.txt,$1)
}
alias -l qsrandom {
msg #channel 8,1QUOTE1,8 $read(quotes.txt)
}
alias -l qsaddquote {
write quotes.txt $1-
}



; ---- Emd ----


confused

Looking over the qode again, what comes to mind, is the question, of does the notice spam the channel?

So anyone using the 1add but is banned, still could make me spam that, or is the notice in a /msg?

And .. the timers I shall se if I can figure out.

were are the banned nicks saved btw?

Should I make a .txt for that? maybe that is why there is no respons, only response on popoumenu. smile


confused

Last edited by gomp; 10/08/06 04:07 PM.
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
I just noticed the spelling..

But The file is named quotes.txt

And I did test it once with the right command.

My quotes.txt look like thsi atm (when testing):

Code:
1 "Everything can contain nothing.. but nothing cannot contain everything.. Thus, nothing becomes, what it already is.."
2 "We need no religion, as we are; A legion!"
3 "The Truth is relative to its context."
4 "Never doubt your doubts!"
5 "I neither agree nor dis-agree, I keep open, and let be!" 


I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
I make new post to not make so messy post..
I have a ahadr time wrtitng here.

Anyways. I just recalled another function I'd like to have. and that is

!quotes Which would make me say: "there is XXX number of quotes in the record!" or something like that.

smile


I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.

Link Copied to Clipboard