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.

Hello,

Old posts that have not been replied to for several years.
S
Snapple
Voice
Posts: 38
Joined: Fri Jul 18, 2003 4:41 pm
Location: Israel
Contact:

Hello,

Post by Snapple »

I program in TCL, now in some of my codes, I'm using hebrew (language) vars, my problem is, then when the var is a hebrew channel,
the program can't do if on it like doing:
if {($hebchanvar1 == $hebchanvar2)} { ... }
or
if {([info exists hebchanvar])}

the problem is kind of critical so I can't skip the check
anyone know what is the problem?

Thanks
Snapple
There are 10 kind of people here, the one's who know binary code and the one's who don't.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

What happens if you try if {![string compare $var1 $var2]} { }

Are you actually naming the variable with hebrew chars, or are the values hebrew instead?
S
Snapple
Voice
Posts: 38
Joined: Fri Jul 18, 2003 4:41 pm
Location: Israel
Contact:

hmm...

Post by Snapple »

The value's are hebrew chans
and I think that will work, because [string match does work
but I need it to work with info exists and to get the value, it's more in a list...
Snapple
There are 10 kind of people here, the one's who know binary code and the one's who don't.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

It doesn't matter what is stored in the variable, info exists will work if you are using it correctly. Make sure if it's a global variable that you used the "global" command before "info exists".
S
Snapple
Voice
Posts: 38
Joined: Fri Jul 18, 2003 4:41 pm
Location: Israel
Contact:

hmm..

Post by Snapple »

yeah, there is global, I forgot to mention it's a list,
I mean a($hebchanvar) and inside it there is another value...
Snapple
There are 10 kind of people here, the one's who know binary code and the one's who don't.
S
Snapple
Voice
Posts: 38
Joined: Fri Jul 18, 2003 4:41 pm
Location: Israel
Contact:

hmm... to specify

Post by Snapple »

The var of the list is in english, the lines of the list are in english and hebrew chans, and the contents are or in english or in hebrew
and if it is a hebrew chan, in info exists, or when I try to reach the value,
it say it's empty, anyone has answer please?

thanks
Snapple
There are 10 kind of people here, the one's who know binary code and the one's who don't.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

In my tests, "info exists" works perfectly no matter what the value of the variable is. So you must be doing something else wrong. Maybe you can paste some actual code, with the values you use, and show us.
S
Snapple
Voice
Posts: 38
Joined: Fri Jul 18, 2003 4:41 pm
Location: Israel
Contact:

I'v already shown an example

Post by Snapple »

if {(![info exists cbot([strlwr $target])])} { ....
if the $target is hebrew chan, it will show always true..., that no info exists in there, but the info is there...
Snapple
There are 10 kind of people here, the one's who know binary code and the one's who don't.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

So you're not using your own hebrew variable, you're using one passed from an eggdrop bind.

Most likely, the problem is that when you set the variable in your script, it's using the utf-8 encoding, but when eggdrop creates the variable for the bind, it's not. Try using the tcl "encoding" command to convert the hebrew value.

Maybe a better, easier approach, is to use setudef to store information about each channel. That way, instead of

if {![info exists cbot($chan)]} { ... }

you can say

if {![channel get $chan cbot]} { ... }

which should work better.
S
Snapple
Voice
Posts: 38
Joined: Fri Jul 18, 2003 4:41 pm
Location: Israel
Contact:

ok, thanks but some questions

Post by Snapple »

hmm what is the encoding command? never heard of it =\
and also setufed how do I use it
and the channel get will get the information from the list?

and
thank you very much
Snapple
There are 10 kind of people here, the one's who know binary code and the one's who don't.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

setudef flag cbot

if {![channel get $chan cbot]} { ... } 
Once the game is over, the king and the pawn go back in the same box.
S
Snapple
Voice
Posts: 38
Joined: Fri Jul 18, 2003 4:41 pm
Location: Israel
Contact:

hmm

Post by Snapple »

I need to leave the flag word or change it?
and the setudef is suppose to come before the if or out of code?
Snapple
There are 10 kind of people here, the one's who know binary code and the one's who don't.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Use that "if" inside the proc to see if that channel has the specified channel flag. Read in the tcl-commands.doc file the coments about the "setudef". By default is set to 0, as disabled.
Once the game is over, the king and the pawn go back in the same box.
S
Snapple
Voice
Posts: 38
Joined: Fri Jul 18, 2003 4:41 pm
Location: Israel
Contact:

but will it bring me the info from the list?

Post by Snapple »

Because I need to use the list... not other formats
Snapple
There are 10 kind of people here, the one's who know binary code and the one's who don't.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Whatever you store in your list, you can also store with channel set and retrieve with channel get. Of course, you don't have to do this. Have you looked at the encoding command? Check docs at www.tcl.tk
Locked