This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

mirc scripter new to tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
D
Dark_Aaron
Voice
Posts: 10
Joined: Mon Mar 16, 2009 4:55 pm

mirc scripter new to tcl

Post by Dark_Aaron »

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: Select all

/writeini <file> <section> <item> <value>
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

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
D
Dark_Aaron
Voice
Posts: 10
Joined: Mon Mar 16, 2009 4:55 pm

Post by Dark_Aaron »

arfer wrote: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.
how would i go about making a multi chan topic script

here is an mirc 1 i wrote

Code: Select all

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.
}
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

No clue, I don't read mIRC.

Explain what it does in plain English.
I must have had nothing to do
D
Dark_Aaron
Voice
Posts: 10
Joined: Mon Mar 16, 2009 4:55 pm

Post by Dark_Aaron »

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
User avatar
starr
Voice
Posts: 26
Joined: Sun Mar 18, 2007 1:18 am
Location: Tennessee
Contact:

Post by starr »

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.
D
Dark_Aaron
Voice
Posts: 10
Joined: Mon Mar 16, 2009 4:55 pm

Post by Dark_Aaron »

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
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
D
Dark_Aaron
Voice
Posts: 10
Joined: Mon Mar 16, 2009 4:55 pm

Post by Dark_Aaron »

Code: Select all

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
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

putserv "TOPIC $chan $chan(header) $chan(topic) $chan(divider)..."
Into something like this:

Code: Select all

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: Select all

set $chan(topic) ...
Use this instead:

Code: Select all

#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: Select all

proc TOPICDEFAULTS:proc {nick host handle chan text} {
NML_375
Post Reply