mIRC Home    About    Download    Register    News    Help

Print Thread
#134459 01/11/05 01:55 PM
Joined: Oct 2005
Posts: 35
C
Crap Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
okay, I want a bot made since I dont know how to do it myself. I am going to copy/past some specifications that I (we) thought of, and what we are going to use the bot for.

if this is the wrong forum, please redirect me or tell me where to go.

---------------------------------------------------------------------------
Specifications

I'll describe the bot I have in mind. It's not very complicated, especially not if we choose to ignore the extra functions that would be fun to have, but aren't really vital. The main purpose of this bot would be to facilitate the handling of logs from role-playing sessions over IRC. The basic idea is to have a bot which records and then automatically sends the log to a player who will manually check the content. Everything from there we can handle with php.

Here we go:


Core functions:
x Some sort of authorization mechanism which allows certain users to access the bot. This could be based on some username/password-procedure or by letting ops in the channel access it.
x A log function which records and saves everything said between two given commands, like "start logging" and "stop logging". The log should be saved in a separate text-file and automatically sent by e-mail to a certain address.
x The ability to assign some extra data to the saved log. When the bot starts logging, a user can assign a text string to the log file. For example the command "add player blabla" could insert a row in the beginning of the file which simply states "player blabla". This is to enable us to easily generate a list of the players present during that particular session.
x Before the end of logging, one user should be able to add a summary of the session via the bot. A command "summary everyone lived happily ever after" should add that summary to the beginning of the log file.


Extra functions:
x Statistics for users in the channel
x Ability to record quotes
x The ability for the admin to designate some sort of points to players
---------------------------------------------------------------------------
And some contactinformation:
operagasten@hotmail.com (msn/email)
#antioch-ooc @ freenode

feel free to ask if there is something you want to know.

//Crap


#indierpgs @ magicstar.net Your indie-rpg fix. Online.
#134460 01/11/05 02:49 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try this... it is just a basic script, but should do what you need.

Code:
on *:text:*:[color:red]#yourchannel[/color]: {
  if ($nick isop $chan) {
    if ($1-2 == !start logging) {
      .remove RPGLog.txt
      set %RPGLogging On
    }
    elseif ($1-2 == !stop logging && %RPGLogging == On) {
      unset %RPGLogging
      dcc send [color:red]Nick[/color] RPGLog.txt
    }
  }
  if (%RPGLogging == On) {
    if ($1 == !add) {
      [color:blue]; I would color this differently or do something to make it stand out.[/color]
      write -il1 RPGLog.txt $$2-
    }
    elseif ($1 == !summary) {
      [color:blue]; Again, I would color this differently or do something to make it stand out.[/color]
      write -il1 RPGLog.txt SUMMARY: $$2-
    }
    else write RPGLog.txt < $+ $nick $+ > $1-
  }
  else {
    if ($1 == !addquote) {
      [color:blue]; Right now, this is set to allow all users to add a quote.  If you want only ops
      ; to be able to add the quotes, this section can be moved into the ops-only
      ; section above.[/color]
      write quotes.txt $$2-
    }
    elseif ($1 == !quote) {
      msg $chan $read(quotes.txt)
    }
  }
}


Ok, that will handle your logging and quotes.

Use:
OPS:
!start logging
!stop logging

Everyone:
!add <text>
!summary <text>
!quoteadd <text>
!quote

Note that you need to change the red parts above. Also, this will not keep a copy of the log locally. It will remove the log every time the logging is started. Because it's sending the log file to someone, I didn't think this would be a problem. However, if it is, the log filename can be made to include the date and then it won't need to remove the old logs. That's up to you. I also didn't add time-stamping... feel free to add if needed.

!quote will give a random quote out of the list of quotes. Also note that !addquote and !quote will not work while the logging is enabled. I did this because people shouldn't be using !quote/!addquote while roleplaying as that is OOC.

For the statistics, it depends what you want for statistics.

For the points... it depends what you mean by admin. Do you want the command to give points to be done from the bot itself? Or is a certain nick/address allowed to do it from a message/notice/etc?

Here's a way to do it from the bot itself:

Code:
alias GivePoints {
  if ($2 != $null) {
    if ($hget(RPGPoints) == $null) {
      hmake RPGPoints 20
      if ($exists(RPGPoints.hsh)) {
        hload RPGPoints RPGPoints.hsh
      }
      .timerRPGPointsSave 0 60 hsave RPGPoints RPGPoints.hsh
    }
    hinc $1 $2
  }
}


Use:
/GivePoints <nick> <points>

Example:
/GivePoints Riamus 100


Questions/Comments/Etc, just ask.


Invision Support
#Invision on irc.irchighway.net
#134461 01/11/05 02:53 PM
Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
Try reading the help file for "On Text" events. I knew nothing about scripting when I started, but I looked at examples and read help files. Hint: On Text events trigger when the specified text is said. Also, read the help for "/write", and look at user levels too, for the authorization part. Here's a part of what you need so you can look at it.
Code:
on 1:text:*start writing*:#: {
set %LoggerOn 1
}
on 1:text:*stop writing*:#: {
unset %LoggerOn
}
on 1:text:*:*: {
if (%LoggerOn) { write log.txt $1- }
else { echo }

Hope that helps.
PS--Sorry,

#134462 01/11/05 02:55 PM
Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
LOL, Riamus beat me to it, and outdid my script. I know mine was just basic and a starter though. Advice: just skip over mine. Riamus knows what he's doing! :tongue:

#134463 01/11/05 03:15 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You can still edit or delete your posts up until 2 hours after creating it.


Gone.
#134464 01/11/05 03:26 PM
Joined: Oct 2005
Posts: 35
C
Crap Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
Damn! I feel sooo stupid! What should I do with the code?
I did get that thing wih filling in the red parts, and what the blue parts ment thought...

And thx everyone!


#indierpgs @ magicstar.net Your indie-rpg fix. Online.
#134465 01/11/05 03:36 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Press Alt-R on the bot. Make sure you're on the Remotes tab, then go to File > New. Then, paste it in there. If it doesn't paste on separate lines so that it looks like it does in the forum, then click the Quote button on my post with the code in it and copy everything between the [[b][/b]code] tags and paste that into your new file.


Invision Support
#Invision on irc.irchighway.net
#134466 01/11/05 03:48 PM
Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
I never discourage people helping or asking questions, however, it must be pointed out that this forum isn't a script-request site. Riamus was generous enough this time to code something for you, but as a heads up, do be aware that making a habit of it is unwise. I wouldn't want you or anyone else getting into the habit of posting "I need this, make it for me" posts smile

Regards,


Mentality/Chris
#134467 02/11/05 01:04 PM
Joined: Oct 2005
Posts: 35
C
Crap Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
OK I understand that. It will never happen again. I just didnt know where to start, since I am very new to the scripting-bussines.

But I have a question regarding the bot:

Why dosnt this work? I have mimiced Riamus2's script, but well...
Code:
on *:text:*:#: {
  if ($nick isop $chan) {
    if ($1 == !commands) {
      msg $chan !Start logging Börjar logga #antioch
      msg $chan !Stop logging Avslutar loggningen och skickar den till Snigel
      msg $chan !Add [Spelare] [Roll] Lägger till dig i rollistan
      msg $chan !Summary [Sammanfattning] Lägger till en sammanfattning
      msg $chan !Addqoute [Citat] Lägger till ett citat
      msg $chan !Quote Visar alla citaten
    }
  }
  if ($1 == !commands) {
    msg $chan !Add [Spelare] [Roll] Lägger till dig i rollistan
    msg $chan !Addqoute [Citat] Lägger till ett citat
    msg $chan !Summary [Sammanfattning] Lägger till en sammanfattning
    msg $chan !Quote Visar alla citaten
  }
}

it is a !commands-script.


#indierpgs @ magicstar.net Your indie-rpg fix. Online.
#134468 02/11/05 02:10 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Looks right to me unless I am missing something. How is it not working? What does it do? You know you can't trigger it from the bot itself, right?


Invision Support
#Invision on irc.irchighway.net
#134469 02/11/05 02:48 PM
Joined: Oct 2005
Posts: 35
C
Crap Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
I know! that is why I came here! Again...

is the general !commands-scripts working this way? or is this something totaly wierd?

and what's happening when I type !commands (not from the bot) is absolutely nothing! It dosnt seem to react.

Last edited by Crap; 02/11/05 02:55 PM.

#indierpgs @ magicstar.net Your indie-rpg fix. Online.
#134470 02/11/05 03:22 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I bet you have another on text above it.

You can't have two identical on text events (or other events) in the same script file.

This works:
on *:text:help*:#: { }
on *:text:*:#: { }

This doesn't:
on *:text:*:#: { }
on *:text:*:#: { }

And, this won't either because the * covers everything:
on *:text:*:#: { }
on *:text:help*:#: { }

Similar events will trigger the one that it matches first. It will not trigger any others in the same file even if it matches them. Either combine the 2+ events or put them in separate files.


Invision Support
#Invision on irc.irchighway.net
#134471 02/11/05 03:27 PM
Joined: Oct 2005
Posts: 35
C
Crap Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
ahha! you are right! I have! Thank you!

Last edited by Crap; 02/11/05 03:49 PM.

#indierpgs @ magicstar.net Your indie-rpg fix. Online.
#134472 02/11/05 03:30 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Btw, although the first example I gave is "okay", if you wanted the second on text in that first example to also trigger on help*, it will not as it was already triggered from the first on text in that example.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard