egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mirc scripter new to tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Dark_Aaron
Voice


Joined: 16 Mar 2009
Posts: 10

PostPosted: Mon Mar 16, 2009 5:28 pm    Post subject: mirc scripter new to tcl Reply with quote

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
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Mon Mar 16, 2009 6:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dark_Aaron
Voice


Joined: 16 Mar 2009
Posts: 10

PostPosted: Mon Mar 16, 2009 8:15 pm    Post subject: Reply with quote

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:
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
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Mon Mar 16, 2009 9:58 pm    Post subject: Reply with quote

No clue, I don't read mIRC.

Explain what it does in plain English.
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
Dark_Aaron
Voice


Joined: 16 Mar 2009
Posts: 10

PostPosted: Tue Mar 17, 2009 10:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
starr
Voice


Joined: 18 Mar 2007
Posts: 26
Location: Tennessee

PostPosted: Thu Mar 19, 2009 9:01 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Dark_Aaron
Voice


Joined: 16 Mar 2009
Posts: 10

PostPosted: Thu Mar 19, 2009 5:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Mar 19, 2009 5:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dark_Aaron
Voice


Joined: 16 Mar 2009
Posts: 10

PostPosted: Thu Mar 19, 2009 7:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Mar 19, 2009 7:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber