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.

Character Encode

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

Character Encode

Post by ultralord »

hello.. i have problem from some script.. and i want to fix it.. when bot response he said

Code: Select all

 &#928:&#945:&#957:&#945:&#952:&#951:&#957:&#945:&#970:&#954:&#942: &#931:&#965:&#947:&#954:&#941:&#957:&
i want to change Character Encode to Greek (ISO-8859-7) or other format to test it if works.. can someone help how i can do that on script? like proc something?

thnx
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

string map.
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

Post by ultralord »

can i post code to saw me how i can put string map? :o


thanks
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Code: Select all

set smaps {
"     '     &apos;     \x27  &      \x26  <       \x3C   >       \x3E        \x20
¡    \xA1  ¤   \xA4  ¢     \xA2  £    \xA3   ¥      \xA5  ¦   \xA6
§     \xA7  ¨      \xA8  ©     \xA9  ª     \xAA   «    \xAB  ¬      \xAC
­      \xAD  ®      \xAE  ¯     \xAF  °      \xB0   ±   \xB1  ²     \xB2
}

set defins [string map -nocase $::smaps $input]
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

The above example got word-wrapped by the editor..

The example came from:
http://members.dandy.net/~fbn/dictcom.tcl.txt
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

Post by ultralord »

my script:

Code: Select all

listen 33335 script vbannounce

proc vbannounce {idx} {
control $idx vbincoming
}

proc vbincoming {idx args} {
putlog "$args <-- this is what the board sent to the bot"
  set line [join $args]
if {[join $args] != "" } {
  set chan [lindex $line 0]
  set line [lrange $line 1 end] 
  set line [join $line]
  set line [split $line ";"]

foreach line $line { putserv "PRIVMSG $chan :$line" }
        }
killdcc $idx
}


putlog "Vb3 announce by ShavedApe v1.1 loaded..."
then i put string map inside like :

Code: Select all

listen 33335 script vbannounce

proc vbannounce {idx} {
control $idx vbincoming
}

set smaps {
"     '     &apos;     \x27  &      \x26  <       \x3C   >       \x3E        \x20
¡    \xA1  ¤   \xA4  ¢     \xA2  £    \xA3   ¥      \xA5  ¦   \xA6
§     \xA7  ¨      \xA8  ©     \xA9  ª     \xAA   «    \xAB  ¬      \xAC
­      \xAD  ®      \xAE  ¯     \xAF  °      \xB0   ±   \xB1  ²     \xB2
}

set defins [string map -nocase $::smaps $input] 
proc vbincoming {idx args} {
putlog "$args <-- this is what the board sent to the bot"
  set line [join $args]
if {[join $args] != "" } {
  set chan [lindex $line 0]
  set line [lrange $line 1 end] 
  set line [join $line]
  set line [split $line ";"]

foreach line $line { putserv "PRIVMSG $chan :$line" }
        }
killdcc $idx
}


putlog "Vb3 announce by ShavedApe v1.1 loaded..."
and will be ok ? :S

thanks
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Over a 100 posts and you still don't how TCL works? :roll:
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

This is how it should be:

Code: Select all

listen 33335 script vbannounce

proc vbannounce {idx} {
control $idx vbincoming
}

set smaps {
"     '     &apos;     \x27  &      \x26  <       \x3C   >         \x3E        \x20
¡    \xA1  ¤   \xA4  ¢     \xA2  £    \xA3   ¥      \xA5  ¦   \xA6
§     \xA7  ¨      \xA8  ©     \xA9  ª     \xAA   «    \xAB  ¬      \xAC
­      \xAD  ®      \xAE  ¯     \xAF  °      \xB0   ±   \xB1  ²     \xB2
}

proc vbincoming {idx args} {
  global smaps
  putlog "$args <-- this is what the board sent to the bot"
  set line [string map -nocase $smaps [join $args]]
  if {[join $args] != "" } {
    set chan [lindex $line 0]
    set line [lrange $line 1 end]
    set line [join $line]
    set line [split $line ";"]
    foreach line $line { 
      putserv "PRIVMSG $chan :$line"
    }
    killdcc $idx
  }
}


putlog "Vb3 announce by ShavedApe v1.1 loaded..."
You could also compress all those 'set line ...' into:

Code: Select all

set line [split [join [lrange $line 1 end]] ;]
r0t3n @ #r0t3n @ Quakenet
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

metroid wrote:Over a 100 posts and you still don't how TCL works? :roll:
LOL :P
|AmDeAtH @ Undernet
Death is only the *Beginning*...
Z
Zircon
Op
Posts: 191
Joined: Mon Aug 21, 2006 4:22 am
Location: Montreal

Post by Zircon »

What s so funny in it ? is there any correlation between the number of posts and the depth in knowlefdge of TCL, i dont think so. I can see here some ppl with thousands of post with limited knowledge in TCL, and you ll see that they never reply to any post related to pure TCL. More than that, they can come with very complicated script that you can write in few lines. So in my opinion, you can be good at TCL only if you think it s worth to learn it seriousely.

From the point of vue of an eggdrop user, you don't need to learn TCL, if the scripts are already availible. And you don't need to learn TCL if it s for askin a little modification in a script, or asking for a little script, that s why the section SCRIPT REQUEST is there. You don't need to know TCL if it is for reporting bugs, that s why the section Script Support & Releases is there. You dont need to know TCL to be active in the section EGGDROP HELP. You need to know TCL only when you want to write your own script, or when you didnt get any help to modify some script. I used to code in TCL for my eggdrop 13 years ago now, i was 17 and it was fun, but i quit the eggdrop scene for a decade. Now i m back for 1 year now, and with all the scripts already availible, i dont find really the need to open back my TCL book, i even dont know if i m still having it or lost it.

So in my opinion, there is no correlation between the number of posts and the depth of knowledge of TCL. And remember that most ppl using eggdrop, have no idea about scripting ou programming, but can still manage efficiently the egg, and make the scripts they use work correctly.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Zircon wrote:What s so funny in it ? is there any correlation between the number of posts and the depth in knowlefdge of TCL, i dont think so. I can see here some ppl with thousands of post with limited knowledge in TCL, and you ll see that they never reply to any post related to pure TCL. More than that, they can come with very complicated script that you can write in few lines. So in my opinion, you can be good at TCL only if you think it s worth to learn it seriousely.

From the point of vue of an eggdrop user, you don't need to learn TCL, if the scripts are already availible. And you don't need to learn TCL if it s for askin a little modification in a script, or asking for a little script, that s why the section SCRIPT REQUEST is there. You don't need to know TCL if it is for reporting bugs, that s why the section Script Support & Releases is there. You dont need to know TCL to be active in the section EGGDROP HELP. You need to know TCL only when you want to write your own script, or when you didnt get any help to modify some script. I used to code in TCL for my eggdrop 13 years ago now, i was 17 and it was fun, but i quit the eggdrop scene for a decade. Now i m back for 1 year now, and with all the scripts already availible, i dont find really the need to open back my TCL book, i even dont know if i m still having it or lost it.

So in my opinion, there is no correlation between the number of posts and the depth of knowledge of TCL. And remember that most ppl using eggdrop, have no idea about scripting ou programming, but can still manage efficiently the egg, and make the scripts they use work correctly.
Not to detract any from what zircon has said, but altruistically speaking I would suggest one learn the vehicle in which they ride, and how to do minor repairs themselves, ie: flat-tire changing, jumping the battery, etc.

The more involved you become in your vehicles maintenance the more skilled you become at doing the upkeep yourself, from battery to tire changing. Now think of eggdrop as a vehicle, and tcl as the engine. Most people are fine with keeping everything stock and only using dealer services, but most of us who own a car long enough eventually learn how to accomplish the routine maintenance ourselves. You should treat your eggdrop with equal respect because after all you've given it a nickname (as again, most do their cars..heh), it's your baby, right...? Now the question becomes simple...
Q: "Why learn tcl if your going to use eggdrop?"
A: "Because eggdrop is your vehicle, tcl your engine, and you are the mechanic."

The script archive is your basic starting point, to find something previously scripted with unmalicious behavior (scripts hosted/supported at egghelp are assumed friendly). Don't expect others to keep everything running for you either, at least don't appear to always want something yet never seem to learn from any of those experiences. It just puts you in a bad light, and makes people laugh at your condition, such as iamdeath is doing to Ultralord.

and @Zircon, have you seen this guys posts? Some of them thankfully deleted.. but in your defending a person, you would think you would've done a little backstory and history of their posts to justify someone making the comment iamdeath did before jumping at them as if they were attacking someone undeserving.. heh :wink:
Z
Zircon
Op
Posts: 191
Joined: Mon Aug 21, 2006 4:22 am
Location: Montreal

Post by Zircon »

Hello Speechles

I dont defend anyone, since my comment isnt related to the posts made by ultralord. I react to the possible relation between the number of posts and the depth knowledge of TCL. And from what i saw, you can find ppl with very high number of posts, being here for years, but knowing very little in TCL. For example, some user who is very active in the EGGDROP HELP section can have a high number of posts, without knowing anything in TCL. Same thing for some1 who is very active in Script Requests section, not as a helper :D
Learning TCL is good when you have time and think it s among priorities, you become less dependant of the helpers, and more than that, you can help users that know nothing in TCL :lol: myself, i ll look more in depth in TCL when i ll be less stressed by my other projects.
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Well, it's not funny I know but we have been treated like that too once when we started. But then some of us did not want people to laugh at them then they tried to learn TCL. I am not asking you to stop helping someone, but you must force him to understand what you did for him. NOT Just COPY/PASTE. I am not saying that we are TCL gurus or TCL Cheetahs, I consider myself [censored] in TCL language infront of these great programmers like nml, alchera, sirfz, user, MC8 and many many more... but I tried to learn a little bit. Now I stand at a position that mostly questions I solve by myself.. why? becuase I what SirFz and other suggested me to read and go thru Tutorials and Help files that did help me alot.. I tried to play with TCL and crashed many of my eggdrops and then sit back and cry dayem what did I do.. how the hell should I get back now.. but those days were my lessons. I learned alot from those things..

This guy we who are talking about check his past post, he has been only requesting people to do the compelte jobs for him not to try a little bit..

anyway

peace
deathy.
|AmDeAtH @ Undernet
Death is only the *Beginning*...
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

Post by ultralord »

metroid wrote:Over a 100 posts and you still don't how TCL works? :roll:
:S

Guys i know something but i havent time to test things and i must have the answers because some scripts isnt for home but for some works etc..



thanks Tosser^^ i am going to test it later because i am at work now.. thanks
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

ultralord wrote:
metroid wrote:Over a 100 posts and you still don't how TCL works? :roll:
:S

Guys i know something but i havent time to test things and i must have the answers because some scripts isnt for home but for some works etc..



thanks Tosser^^ i am going to test it later because i am at work now.. thanks
Then you will have to do what the rest of us plebs have to do; make time!
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Post Reply