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.

working with a file

Old posts that have not been replied to for several years.
Locked
s
stockman

working with a file

Post by stockman »

Ok, let me try a different approach to my problem, beings i can't seem to get anyone to give a bit of script to play with in my last topic. then I will make an attempt at tcl from there, which I'm not very comfortable doing. I even hire a coder if I could find one. Come on guys I know someone knows how to do this.

so here goes

how do I put a host mask into a file on the shell and then when someone does !stocklist it see's if the users host mask is in the file?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Put your hostmasks into a file with a text editor.

Make a bind for the !stocklist command with the "bind" command, probably with the "pub" binding. Check the tcl-commands.doc that comes with eggdrop.

To see if the user's hostmask is in the file, open up the file ("open"), read it ("read", "split"), close the file ("close"), and search the results ("foreach", "string match"). Check the tcl manual at http://www.tcl.tk/man/tcl8.4/TclCmd/contents.htm for info on each command.

Now you have pretty much all the commands you need, as well as the order they go in.
s
stockman

Post by stockman »

I now realize no one is going to write this code for me, but a small example sure would help.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Example bind: bind pub - !baa myproc

Example of defining a proc: proc something {a b c} { # your code here }

Example of opening a file: set fp [open file]

Example of reading the lines: set lines [split [read -nonewline $fp] "\n"]

Example of closing a file: close $fp

Example of foreach: foreach element $somelist { putlog $element }

Example of if statement: if {2 == 2} { putlog "true!" } { putlog "false!" }

Example of string matching: set matches [string match "sheep*" "sheep are sexy"]
s
stockman

Post by stockman »

stdragon wrote:Example bind: bind pub - !baa myproc

Example of defining a proc: proc something {a b c} { # your code here }

Example of opening a file: set fp [open file]

Example of reading the lines: set lines [split [read -nonewline $fp] "\n"]

Example of closing a file: close $fp

Example of foreach: foreach element $somelist { putlog $element }

Example of if statement: if {2 == 2} { putlog "true!" } { putlog "false!" }

Example of string matching: set matches [string match "sheep*" "sheep are sexy"]
Stdragon I appreciate your help, but hell I don't even know how to start to put that into tcl format, when I ask for an example I meant something in code. Is there any script or similiar script around that someone has done this, I would think something simiar to this has happened or needed before.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

stockman wrote: Stdragon I appreciate your help, but hell I don't even know how to start to put that into tcl format, when I ask for an example I meant something in code. Is there any script or similiar script around that someone has done this, I would think something simiar to this has happened or needed before.
stockman, there are piles of examples at www.egghelp.org/tcl.htm . Or you can read some tutorials on http://www.suninet.nl/tcl.php.

But with a little logical thinking you can convert stdragon's lines easily into a working script.
s
stockman

Post by stockman »

Thanks for your help, I know you were trying to help me , but as I said before,I"m just not a coder, I tried it and screwed more things up than I fixed anything. Some people are not born to do this stuff and some are, I just happen to be one thats not, I'm good in a lot of other things but I flunked this one.

I finally found someone to code it for me. not from here.

Thanks again
Locked