| View previous topic :: View next topic |
| Author |
Message |
Dark_Aaron Voice
Joined: 16 Mar 2009 Posts: 10
|
Posted: Mon Mar 16, 2009 5:28 pm Post subject: mirc scripter new to tcl |
|
|
hey im Aaron ive been scripting in mirc for a while
i want to know how to store stuff to a database oor ini or whatever
like in mirc theirs
| Code: | | /writeini <file> <section> <item> <value> |
|
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Mon Mar 16, 2009 6:58 pm Post subject: |
|
|
Been there, done that, got the tee shirt (if you mean store in a file)
http://forum.egghelp.org/viewtopic.php?t=16624
If you mean to a database proper then you need an addon such as the tcl interface for mysql. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
Dark_Aaron Voice
Joined: 16 Mar 2009 Posts: 10
|
Posted: Mon Mar 16, 2009 8:15 pm Post subject: |
|
|
how would i go about making a multi chan topic script
here is an mirc 1 i wrote
| Code: | on *:TEXT:!topic *:#: {
if ($nick isop # || $nick ishop #) {
writeini network $+ .ini # topic $2-
topic # $readini($network $+ .ini, #, topic) // $readini($network $+ .ini, #,owner) is $readini($network $+ .ini, #, status) // $readini($network $+ .ini, #, static)
}
else msg # Sorry $nick $+ , you must be an OP(@) or HOP(%) to use this command.
}
|
|
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Mon Mar 16, 2009 9:58 pm Post subject: |
|
|
No clue, I don't read mIRC.
Explain what it does in plain English. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
Dark_Aaron Voice
Joined: 16 Mar 2009 Posts: 10
|
Posted: Tue Mar 17, 2009 10:52 pm Post subject: |
|
|
| arfer wrote: | No clue, I don't read mIRC.
Explain what it does in plain English. |
its a multichan topic script that reads an ini and writes to 1 |
|
| Back to top |
|
 |
starr Voice

Joined: 18 Mar 2007 Posts: 26 Location: Tennessee
|
Posted: Thu Mar 19, 2009 9:01 am Post subject: |
|
|
There are many scripts in the TCL Archive. Search topic and see which one is as close to what your looking for and use it for reference:)
I use MC_8's topic resync great script. _________________ Starr
www.dcs-computer-services.net |
|
| Back to top |
|
 |
Dark_Aaron Voice
Joined: 16 Mar 2009 Posts: 10
|
Posted: Thu Mar 19, 2009 5:06 pm Post subject: |
|
|
| starr wrote: | There are many scripts in the TCL Archive. Search topic and see which one is as close to what your looking for and use it for reference:)
I use MC_8's topic resync great script. |
starr where do u live in TN i live in savannah |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Mar 19, 2009 5:50 pm Post subject: |
|
|
There is no native database support in eggdrop nor tcl. Tcl does however provide a nice (and in my opininon easy to use) interface for reading and writing to files.
There are some extensions such as mysqltcl, that allows you to communicate with an MySQL database.
Also, tcllib does have an inifile extension that may be of interest.
Also, if you got some user- or channel-related data, eggdrop does provide some facilities for storing them. For users, they're called the XTRA field (see the setuser tcl command), while for channels you can use the setudef command to create custom channel settings. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Dark_Aaron Voice
Joined: 16 Mar 2009 Posts: 10
|
Posted: Thu Mar 19, 2009 7:11 pm Post subject: |
|
|
| Code: |
proc TOPICDEFAULTS:proc { nick chan host handel text } {
set $chan(topic) "Channel Topic"
set $chan(divider) "||"
set $chan(owner) "The topic"
set $chan(verb) "has"
set $chan(status) "been set."
set $chan(header) "Topic:"
set $chan(static) "Welcome to the channel."
putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider) $chan(owner) $chan(verb) $chan(status) $chan(divider) $chan(static)"
}
proc TOPIC:proc { nick chan host handel text } {
if ([isop $nick $chan]) {
set $chan(topic) $text
putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider) $chan(owner) $chan(verb) $chan(status) $chan(divider) $chan(static)"
}
else {
putserv "PRIVMSG $chan Error: You are not channel operator."
}
}
proc HEADER:proc { nick chan host handel text } {
if ([isop $nick $chan]) {
set $chan(header) $text
putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider) $chan(owner) $chan(verb) $chan(status) $chan(divider) $chan(static)"
}
else {
putserv "PRIVMSG $chan Error: You are not channel operator."
}
}
proc OWNER:proc { nick chan host handel text } {
if ([isop $nick $chan]) {
set $chan(owner) $text
putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider) $chan(owner) $chan(verb) $chan(status) $chan(divider) $chan(static)"
}
else {
putserv "PRIVMSG $chan Error: You are not channel operator."
}
}
proc VERB:proc { nick chan host handel text } {
if ([isop $nick $chan]) {
set $chan(verb) $text
putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider) $chan(owner) $chan(verb) $chan(status) $chan(divider) $chan(static)"
}
else {
putserv "PRIVMSG $chan Error: You are not channel operator."
}
}
proc STATUS:proc { nick chan host handel text } {
if ([isop $nick $chan]) {
set $chan(status) $text
putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider) $chan(owner) $chan(verb) $chan(status) $chan(divider) $chan(static)"
}
else {
putserv "PRIVMSG $chan Error: You are not channel operator."
}
}
proc STATIC:proc { nick chan host handel text } {
if ([isop $nick $chan]) {
set $chan(static) $text
putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider) $chan(owner) $chan(verb) $chan(status) $chan(divider) $chan(static)"
}
else {
putserv "PRIVMSG $chan Error: You are not channel operator."
}
}
proc DIVIDER:proc { nick chan host handel text } {
if ([isop $nick $chan]) {
set $chan(divider) $text
putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider) $chan(owner) $chan(verb) $chan(status) $chan(divider) $chan(static)"
}
else {
putserv "PRIVMSG $chan Error: You are not channel operator."
}
}
bind pub - "!topic" TOPIC:proc
bind pub - "!header" HEADER:proc
bind pub - "!owner" OWNER:proc
bind pub - "!tdefaults" TOPICDEFAULTS:proc
bind pub - "!verb" VERB:proc
bind pub - "!status" STATUS:proc
bind pub - "!static" STATIC:proc |
here is a script me & my friend wrote
can some1 check it i haven't loaded it yet |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Mar 19, 2009 7:26 pm Post subject: |
|
|
There is an ongoing irc protocol error, namely that the last parameter should be prefixed with a : should it contain any whitespaces..
Further, you cannot have an array with the same name as a scalar variable (that is, you can't have $chan and $chan(something) ). Also, I believe you intended that array to be in the global namespace (globalspace). Any variable created within a proc will not be available outside the proc, and it's value does not persist in between calls. To access a variable in the global globalspace, prefix the name with the namespace separator ::
Change this:
| Code: | | putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider)..." |
Into something like this:
| Code: | | putserv "TOPIC $chan :$::chan(header) $::chan(topic) $::chan(divider)..." |
Next, you should only prefix a variable with $ when you intend to do a variable substitution. That means, taking the contents of the variable and inserting it directly into the command line replacing the variable name before the command line is evaluated.
As such, these lines will cause an error:
| Code: | | set $chan(topic) ... |
Use this instead:
| Code: | #set the variable in the local namespace, will not persist in between calls:
set chan(topic) ...
#set the variable in globalspace, which will persist in between calls:
set ::chan(topic) ... |
Also, your parameter lists in your proc is in the wrong order. For pub bindings, the order is nickname, host, handle, channel, and text. The names does not matter (with the exeption of "args" - but simply stay away from that for now), just the order.
Considder this:
| Code: | | proc TOPICDEFAULTS:proc {nick host handle chan text} { |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|