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.

Search found 17 matches

by blotter45
Sat Apr 22, 2006 2:55 am
Forum: Scripting Help
Topic: selective whitespace trimming
Replies: 3
Views: 4740

why not simply adding the whitespace to the re, if you really love these slow things? { years?} Actually I took your advice and applied it to string map instead of regsub, much better ;) proc sr:shortdur { t } { set t [duration $t] set t [string map {" years" "y" " year&quo...
by blotter45
Sat Apr 22, 2006 12:50 am
Forum: Scripting Help
Topic: selective whitespace trimming
Replies: 3
Views: 4740

selective whitespace trimming

heya guys, I'm just looking for a quick way to trim out certain whitespaces from a string. Here is a proc that just takes a seconds input, takes the [duration seconds] value, and trims it down (so weeks becomes w, days becomes d, and so on): proc sr:shortdur { t } { set t [duration $t] regsub -all -...
by blotter45
Tue May 24, 2005 5:32 pm
Forum: Archive
Topic: question with some tcl + php code
Replies: 7
Views: 2311

hmm, okay thats what I would do: remove all those wannabe list braces {} from the fputs thing in the php scripts. mark each end of a line with unique character... like \n or using an other like ~ or ° depending, which wont cause other troubles ^-^. then in your tcl scripts, use at the very begining...
by blotter45
Tue May 24, 2005 12:46 pm
Forum: Archive
Topic: question with some tcl + php code
Replies: 7
Views: 2311

I think this is a step in the right direction tho: fputs($fp, addcslashes("{ mystring }", "[]{}")); when I use that method, all the the characters are properly shown on irc, but each word is shown on it's own line, that's the only problem. and then I tried using addcslashes($varn...
by blotter45
Tue May 24, 2005 12:19 pm
Forum: Archive
Topic: question with some tcl + php code
Replies: 7
Views: 2311

The tcl code is supposed to take each line from the php script, and output them on irc. But I get alot of tcl errors about "unmatched open brace in list", and only 1 line of text is shown on irc...[/code] Try using the php function addcslashes . I think the problem is not the tcl code but...
by blotter45
Tue May 24, 2005 11:07 am
Forum: Archive
Topic: question with some tcl + php code
Replies: 7
Views: 2311

question with some tcl + php code

Hiya guys, I've got an eggdrop tcl script, which takes output from a php script, and then announces it to a channel. The php output is in the form: line 1 line 2 line 3 etc here are the lines of php code that send the output: $fp = fsockopen ($botaddr, $botport, $errno, $errstr, 120); fputs($fp,&quo...
by blotter45
Sat Mar 19, 2005 8:03 am
Forum: Archive
Topic: help with random number proc
Replies: 2
Views: 1299

help with random number proc

Hiya ;) I'm trying to make a proc to output a string of random numbers, based on a given limit. bind dcc o|- otrandset ot:randset #number of random questions to pick each time a test is begun set ot_var(qlimit) "10" proc ot:total { } { # returns the number of total questions global ot_q re...
by blotter45
Wed Mar 02, 2005 3:18 pm
Forum: Archive
Topic: help replacing some extended ascii characters
Replies: 17
Views: 7558

proc urlEncode {url} { if {[regexp {(.*)\?(.*)} $url -> pre sur]} { set result ${pre}? foreach {x} [split $sur {}] { if {[regexp {[^a-zA-Z0-9=%]} $x]} { append result "%[format %02x [scan $x %c]]" } else { append result $x } } return $result } return $url } sorry edited it for got a % Jus...
by blotter45
Wed Mar 02, 2005 3:14 pm
Forum: Archive
Topic: help replacing some extended ascii characters
Replies: 17
Views: 7558

% time "urlEncode $url" 100 203 microseconds per iteration % time "slowUrlEncode $url" 100 379 microseconds per iteration % here a simple proc that is bit faster then the one above .. proc urlEncode {url} { if {[regexp {(.*)\?(.*)} $url -> pre sur]} { set result ${pre}? foreach ...
by blotter45
Wed Mar 02, 2005 3:10 pm
Forum: Archive
Topic: help replacing some extended ascii characters
Replies: 17
Views: 7558

sounds like an encoding bug...what is your system encoding? putlog "System encoding: [encoding system]" try this proc: proc slowUrlEncode str { set out "" foreach c [split $str ""] { if {[string match {[A-Za-z0-9]} $c]} { append out $c } { append out [switch [string by...
by blotter45
Wed Mar 02, 2005 8:06 am
Forum: Archive
Topic: help replacing some extended ascii characters
Replies: 17
Views: 7558

try this proc for urlencode proc urlencode { text } { regsub -all {\%} $text "%25" text set i [string length $text] # Loop through and replace all non alpha / numeric characters # with their relevant %{HEX ascii code} values. while {([regexp -nocase {[^a-z0-9%]} $text toh])&&!($i ...
by blotter45
Wed Mar 02, 2005 6:10 am
Forum: Archive
Topic: help replacing some extended ascii characters
Replies: 17
Views: 7558

Just keeping this thread alive ;)

Does anybody have any ideas about getting certain extended ascii chars to translate?
by blotter45
Tue Mar 01, 2005 12:14 am
Forum: Archive
Topic: help replacing some extended ascii characters
Replies: 17
Views: 7558

sorry it took so long to get back again, but my cable was out most of the day.. ok, here is the latest code I'm using, and it represents all the additions from user (thanks again for your help m8): proc makeUrlencodeMap {} { for {set i 0} {$i<256} {incr i} { set c [format %c $i] if {![string match \...
by blotter45
Mon Feb 28, 2005 10:19 am
Forum: Archive
Topic: help replacing some extended ascii characters
Replies: 17
Views: 7558

I just add a line to putlog the value of $query to the partyline so I can see what is being sent out, and it shows that §ent§ gets sent out unaltered.
by blotter45
Mon Feb 28, 2005 9:54 am
Forum: Archive
Topic: help replacing some extended ascii characters
Replies: 17
Views: 7558

sorry I didn't see that code you pasted until after I typed that last reply.

but when I added your code, and then used this in that proc of mine above:

set t [urlencode $t]

the script doesn't change the string before it gets sent (ie, §ent§ remains the same and gets sent that way)