/* MakeCFG 0.3 İ2001 Michael Trebilcock */
Options Results
Parse Arg Args

IF Args="" THEN Args="AInfoBOT.cfg"

IF Exists(Args) THEN DO
 SAY ""
 SAY "You already have a "Args
 Call SayMsg("Continue with MakeCFG?")
 Parse Pull Answer
 IF Left(Upper(Answer),1)="N" THEN Exit
End

SAY ""

IF ~Open(File,Args,"W") THEN DO
 SAY "Unable to create "Args
 Exit
End

Call WriteLn(File,"*** AInfoBOT configuration file, don't change format/layout ***")
Call WriteLn(File,"")

SAY "Welcome to MakeCFG, this program allows you to"
SAY "create a config file for AInfoBOT, simply follow"
SAY "the prompts, just press enter if you want to"
SAY "leave anything blank.."
SAY ""
Call SayMsg("Press enter to continue..")
Parse Pull
SAY ""
SAY ""

Call SayMsg("1st Nickname:")
Parse Pull Nick.1
Call WriteLn(File,"Nick.1 = "Nick.1" /* Default nickname to use */")

Call SayMsg("2nd Nickname:")
Parse Pull Nick.2
Call WriteLn(File,"Nick.2 = "Nick.2" /* Second, alternative nick */")

Call SayMsg("3rd Nickname:")
Parse Pull Nick.3
Call WriteLn(File,"Nick.3 = "Nick.3" /* Third, alternative nick */")

Call SayMsg("4th Nickname:")
Parse Pull Nick.4
Call WriteLn(File,"Nick.4 = "Nick.4" /* Forth, alternative nick */")

SAY ""
Call WriteLn(File,"")
SAY "Enter a default port number AInfoBOT will connect"
Call SayMsg("to if a port number isn't specified:")
Parse Pull DefPort
Call WriteLn(File,"DefPort = "DefPort" /* Default port number to connect to */")

SAY "Enter a version reply for CTCP VERSION requests"
Call SayMsg("(Example: mIRC32 v5.7 K.Mardam-Bey):")
Parse Pull Version
Call WriteLn(File,"Version = "Version)

SAY ""
Call WriteLn(File,"")
SAY "Enter here the number of ctcp requests, per"
SAY "so many seconds, will trigger the ctcp"
Call SayMsg("flood protection (Example is 5:5):")
Parse Pull CTCPFlood
Call WriteLn(File,"CTCPFlood   = "CTCPFlood" /* How many ctcps in so many secs, is a CTCP flood */")

SAY "Enter here, how many times people can query"
SAY "the bot, in a certain amount of seconds,"
SAY "before the query flood protection"
Call SayMsg("is triggered (Example is 5:5):")
Parse Pull QueryFlood
Call WriteLn(File,"QueryFlood  = "QueryFlood" /* How many queries in so many secs, is a query flood */")

SAY "Enter here, how long CTCP requests will be"
SAY "ignored for after a ctcp flood"
Call SayMsg("(in seconds):")
Parse Pull CTCPIgnore
Call WriteLn(File,"CTCPIgnore  = "CTCPIgnore" /* How many secs CTCPs are ignored after a CTCP flood */")

SAY "Enter here, how long Queries to the bot will"
SAY "be ignored for, after a query flood"
Call SayMsg("(in seconds):")
Parse Pull QueryIgnore
Call WriteLn(File,"QueryIgnore = "QueryIgnore" /* How many secs queries are ignored after a query flood */")

SAY "Enter here, the delay (in seconds) before"
Call SayMsg("each save of the database:")
Parse Pull UPDTime
Call WriteLn(File,"UPDTime     = "UPDTime" /* How often, in seconds to update the database */")

SAY ""
Call WriteLn(File,"")
Call SayMsg("Enable learning? 1 = Yes, 0 = No:")
Parse Pull LearnOn
Call WriteLn(File,"LearnOn      = "LearnOn" /* Enable learning? 1 = Yes, 0 = No */")

Call SayMsg("Enable forget support?")
Parse Pull ForgetOn
Call WriteLn(File,"ForgetOn     = "ForgetOn" /* Enable forget support? */")

Call SayMsg("Enable 'tell' support?")
Parse Pull TellOn
Call WriteLn(File,"TellOn       = "TellOn" /* Enable tell support? */")

Call SayMsg("Enable querying?")
Parse Pull WhatIsOn
Call WriteLn(File,"WhatIsOn     = "WhatIsOn" /* Enable people to query the bot for information? */")

SAY "Rejoin channel when kicked? 1 = Yes, 0 = No"
Call SayMsg("it is possible to be flooded off this way:")
Parse Pull RejoinOnKick
Call WriteLn(File,"RejoinOnKick = "RejoinOnKick" /* Rejoin the channel when kicked? /*")

SAY "Enable karma support?"
Call SayMsg("(not implemented yet):")
Parse Pull KarmaOn
Call WriteLn(File,"KarmaOn      = "KarmaOn" /* Enable karma support? */")

SAY ""
Call WriteLn(File,"")

SAY "Enter here, the ircname/realname for the bot,"
Call SayMsg("can be a homepage or email address:")
Parse Pull Realname
Call WriteLn(File,"Realname = "Realname)

SAY "Enter the username ([4muser[0m@host)"
Call SayMsg("to connect with:")
Parse Pull Username
Call WriteLn(File,"Username = "Username" /* Default username to use */")

SAY ""
Call WriteLn(File,"")
SAY "Enable master support? this will allow you"
SAY "to fully control the bot, giving you"
SAY "access to raw command sending"
Call SayMsg("1 = Yes, 0 = No:")
Parse Pull MasterOn
Call WriteLn(File,"MasterOn   = "MasterOn" /* Enable raw command sending? 1 = Yes, 0 = No */")

Call SayMsg("[4m[1mYOUR[0m nickname on IRC:")
Parse Pull MasterNick
Call WriteLn(File,"MasterNick = "MasterNick" /* YOUR nickname on IRC, to control raw commands */")

Call SayMsg("Ending of [4m[1mYOUR[0m hostname/ip (eg. ihug.com.au):")
Parse Pull MasterHost
Call WriteLn(File,"MasterHost = "MasterHost" /* The ending of YOUR hostname */")

SAY ""
SAY ""
SAY ""
Call WriteLn(File,"")
Call WriteLn(File,"*** Server list ***")
Call WriteLn(File,"")
SAY "Server settings"
SAY "ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ"
SAY ""

i=1

ServAgain:
Call SayMsg("Name for server "i":")
Parse Pull Name.i
Call WriteLn(File,"Name."i"      = "Name.i)

Call SayMsg("Server host/ip:")
Parse Pull Server.i
Call WriteLn(File,"Server."i"    = "Server.i)

Call SayMsg("Port (blank for default):")
Parse Pull Port.i
Call WriteLn(File,"Port."i"      = "Port.i)

SAY "Channel(s) to autojoin, for example"
Call SayMsg("(#Chan1 #Chan2 #Chan3):")
Parse Pull Autojoin.i
Call WriteLn(File,"Autojoin."i"  = "Autojoin.i)

SAY "Keyword(s) for the channel(s)"
Call SayMsg("(Eg. Key1 Key2 Key3...):")
Parse Pull Keyword.i
Call WriteLn(File,"Keyword."i"   = "Keyword.i)

Call SayMsg("Password (leave blank for none):")
Parse Pull Pass.i
Call WriteLn(File,"Pass."i"      = "Pass.i)

SAY "What to msg the channel(s) upon join(s)"
Call SayMsg("leave blank for nothing:")
Parse Pull Autogreet.i
Call WriteLn(File,"Autogreet."i" = "Autogreet.i)

SAY "Path to log the IRC connection to"
Call SayMsg("(Eg. RAM:Log.txt):")
Parse Pull Log.i
Call WriteLn(File,"Log."i"       = "Log.i)

SAY ""
Call SayMsg("Configure another server?")
Parse Pull Answer
IF Left(Upper(Answer),1)="N" THEN DO
 Call Close(File)
 Exit
End

Call WriteLn(File,"---")

i=i+1
SAY ""
Call ServAgain()
Exit

SayMsg:
ADDRESS COMMAND 'ECHO "'Arg(1)' " NOLINE'
Return 0
