mIRC Home    About    Download    Register    News    Help

Print Thread
Yourbot IRC bot Quote script #172846 17/03/07 04:22 AM
Joined: Mar 2007
Posts: 7
M
Metalhead Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2007
Posts: 7
Hi there. I have a Yourbot IRC bot. (http://www.ybbot.com/)

Anyhow, I've been looking and looking for a quote script for it so it can record quotes and randomnly say them. Is this possible?

Example:
Quote:
<Myname>!addquote <personsname> insertquotehere
<MyBot>Quote #1 added <personsname> insertquotehere

Randomnly...

<Mybot> Quote: <personsname> insertquotehere


Is that easy to script or code? any help would be appreciated. smile

edit: Yes, I've used the search, I found something VERY close to what I'm looking for, but not quite.

Last edited by Metalhead; 17/03/07 04:26 AM.

Canadian newbie
Re: Yourbot IRC bot Quote script [Re: Metalhead] #172847 17/03/07 04:47 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If you found something that's very close, it would (probably) be easiest if you gave us a link to the one that's close, and then told us what you want in it that isn't there and/or what's in it that you don't want.

Most quote scripts are very simple, and most alterations are fairly simple to code, but without the details (and knowing that there's already one that's very close helps) there's not much else we can do.

Re: Yourbot IRC bot Quote script [Re: RusselB] #172870 17/03/07 02:00 PM
Joined: Mar 2007
Posts: 7
M
Metalhead Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2007
Posts: 7
Oh! Sure.

http://forums.mirc.com/ubbthreads.php?ubb=showthreaded&Number=169648&an=&page=0

Kind of like that...But of course, for the bot. I already tried running this script through the bot but it didn't work completely. I know nothing about coding/scripting...So I'm not quite sure what has to go in there to make this quote script work for the bot. But what I wanted added in that script would be something to make it randomnly say the quotes...Or say the quotes when whoever made the quote, joins the channel. Example:

randomguy has joined #channel
<Bot> Quote #14 <randomguy> hisquotehere


What I do know is all my bots scripts start with...
Quote:

;check for start.mrc to be loaded for stability
on 1:LOAD: {
if ($script(start.mrc) == $null) { .load -rs scripts\start.mrc | /echo 4!!!!> Warning: A vital file has not been loaded, please restart the bot (press F9) to load this file. }
}
;begin scripting


Thanks for any help you can provide.

Last edited by Metalhead; 17/03/07 02:05 PM.

Canadian newbie
Re: Yourbot IRC bot Quote script [Re: Metalhead] #172873 17/03/07 02:28 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Heh, that's the one I wrote up. First, make sure you use the very last version in that thread and any changes that may have been mentioned after the last full version was shown.

As far as loading it into your bot, I don't know how that bot works, but you shouldn't need that on LOAD on every script. Once is enough and the chances of a script randomly unloading itself is minor, so it's not really important to have it to begin with.


Invision Support
#Invision on irc.irchighway.net
Re: Yourbot IRC bot Quote script [Re: Riamus2] #172882 17/03/07 04:47 PM
Joined: Mar 2007
Posts: 7
M
Metalhead Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2007
Posts: 7
Hmm, I tried putting the script in the bots script folder, without any luck. :s

I would've asked on the bots homepage forums, but well, their forums don't exist anymore.


Canadian newbie
Re: Yourbot IRC bot Quote script [Re: Metalhead] #172890 17/03/07 05:42 PM
Joined: Jan 2007
Posts: 259
K
Kardafol Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
If you want a quote script, I'll make one using a identifier simmular to $quote. I'll post it when I'm done with it.
Edit:
Progress:
$kquote(add) - ~100%
$kquote(get) - ~100%
$kquote(del) - ~100%
clean up code, add documentation [on-pause ;D]
$kquote(search) - [queued]

Last edited by Kardafol; 17/03/07 07:49 PM.

Those who can, cannot. Those who cannot, can.
Re: Yourbot IRC bot Quote script [Re: Kardafol] #172893 17/03/07 06:00 PM
Joined: Mar 2007
Posts: 7
M
Metalhead Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2007
Posts: 7
Thank you very much!


Canadian newbie
Re: Yourbot IRC bot Quote script [Re: Metalhead] #172902 17/03/07 07:49 PM
Joined: Jan 2007
Posts: 259
K
Kardafol Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
Ok, done this so far (should be enough to work, however you need to make the on *:text: stuff, aswell as some error checking)
Code:
alias kquote {
  ;Set what database to use, if not the default.
  var %db = quote. $+ $iif($prop,$prop,default), %dbfile = $^qt($scriptdir $+ %db $+ .dat)
  if (!$hget(%db)) {
    hmake %db 100
    if ($isfile(%dbfile)) {
      hload -b %db %dbfile
    }
    else {
      write -c %dbfile
    }
  }
  ;Check if its an identifier.
  if ($isid) {
    ;Check if $1 is 'add'
    if ($1 == add) {
      ;make sure all parameters are given
      if (($3 == $null) || ($numtok($2,32) > 1) || ($2 == $null)) {
        return $false
      }
      ;set key variables, such as the author, ID of the quote, etc.
      var %author = $2, %quote = $3-, %id = $calc($hget(%db,0).item + 1), %verify = $hget(%db,%id), %addtime = $ctime, %deleted = $false
      ;make sure we don't over write a quote
      while (%verify) {
        var %id = $calc(%id + 1), %verify = $hget(%db,%id)
      }
      ; add the quote
      hadd %db %id %addtime %deleted %author %quote
      hsave -b %db %dbfile
      ; check if it was added
      if ($hget(%db,%id) == %addtime %deleted %author %quote) {
        ;return the quote ID, and $true
        return $true %id
      }
      else {
        ;i'm not sure how this will happen, but its good to have 'just in case'
        return $false unexpected_error
      }
    }
    elseif ($1 == get) {
      ;Find out if there are any quotes in the database or not.
      if ($hget(%db,0).item == 0) {
        return $false empty
      }
      ; Get the quote, and check if it exists, is deleted, etc.
      var %quote = $iif($2 != $null,$2,$rand(1,$hget(%db,0).item)), %gquote = $hget(%db,%quote), %del = $gettok(%gquote,2,32)
      if (%gquote == $null) {
        return $false non-existant %quote
      }
      elseif (%del) {
        ; Quote has been deleted        
        return $false deleted %quote
      }
      else {
        ; Return the quote #, quote, author and creation time.
        return $true %quote $gettok(%gquote,1,32) $gettok(%gquote,3-,32)
      }
    }
    elseif ($1 == del) {
      ; Check if all parameters are given
      if ($2 == $null) {
        return $false
      }
      ; check if there are quotes in the database
      if ($hget(%db,0).item == 0) {
        ;return empty since there are no quotes in the database.
        return $false empty $2
      }
      ; Check if the quote exists
      var %quote = $2, %gquote = $hget(%db,%quote)
      if (%gquote == $null) {
        ;if the quote dosen't exist, return false
        return $false non-existant %quote
      }
      elseif ($gettok(%gquote,2,32) == $true) {
        ;check if its already deleted
        return $false already-deleted %quote
      }
      else {
        ;delete the quote...
        hadd %db %quote $gettok(%gquote,1,32) $true $gettok(%gquote,3-,32)
        ;return sucessfull
        return $true %quote
      }
    }
    elseif ($1 == version) {
      return $!kquote $+(v,$qver) by Kardafol @ Gamesurge [#Kardafol]
    }
  }
}
alias -l qver {
  return 0.4
}
alias -l ^qt {
  return $iif("*" iswm $$1-,$1-,$iif("* iswm $1-,$+($1-,"),$iif(*" iswm $1-,$+(",$1-),$+(",$1-,"))))
}


Documentation so far:

$kquote(add,author,quote)[.database]
This will add a quote to a database (default if [.database] isn't specified)
Returns: $true <id of added quote> for sucess, $false for failure (no quote and or no author given)
Valid examples: $kquote(add,Kardafol,<Kardafol> It lives!).#Test
$kquote(add,someguy,<someotherguy> quote)
Invalid examples: $kquote(add,someguy)
$kquote(add, ,<quote>).#chan


$kquote(get [,quote id])[.database]
This will get a quote from [.database], or from the default.

Returns: $true <id of quote> <time added (in $ctime format)> <author> <quote> Successfull get
$false non-existant <quote id> Quote dosen't exist.
$false deleted <quote id> Quote was deleted.
$false empty No quotes in the database

$kquote(del, [quote id])[.database]
This will delete a quote, though you can restore it (will add function to do that later, aswell as a function to view hidden quotes)

Returns: $true [quote id] Sucessfull deletion
$false already-deleted [quote id] Quote already deleted
$false non-existant [quote id] Quote dosen't exist
$false empty [quote id] database is empty.

I'll document it more when i get around to it, aswell as possibly add a search function, and add some more consistency to it.



Those who can, cannot. Those who cannot, can.
Re: Yourbot IRC bot Quote script [Re: Kardafol] #172911 17/03/07 10:17 PM
Joined: Mar 2007
Posts: 7
M
Metalhead Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2007
Posts: 7
Thank you!

Now I'm just trying to figure out how to make the script work with the bot. Got the script in there, but it's not responding.


Canadian newbie
Re: Yourbot IRC bot Quote script [Re: Metalhead] #172912 17/03/07 10:18 PM
Joined: Jan 2007
Posts: 259
K
Kardafol Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
I'll see if i can make it compatible with the bot you're using.


Those who can, cannot. Those who cannot, can.
Re: Yourbot IRC bot Quote script [Re: Kardafol] #172913 17/03/07 10:19 PM
Joined: Mar 2007
Posts: 7
M
Metalhead Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2007
Posts: 7
Holy moly, quick reply. I provided the link in my first post. Just download it and extract into your mIRC folder. Should probably make a dummy folder somewhere so you don't mess up your real mIRC.


Canadian newbie
Re: Yourbot IRC bot Quote script [Re: Metalhead] #172914 17/03/07 10:23 PM
Joined: Jan 2007
Posts: 259
K
Kardafol Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
I'm reading the code, finding out what each level does/etc ;P


Those who can, cannot. Those who cannot, can.