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.

inserting a space

Old posts that have not been replied to for several years.
Locked
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

inserting a space

Post by NewzUK »

Hi - I have this string that adds colour to pieces of data before it's sent to the channel - what I'm trying to do is add a space of either the red or green colour infront of $test, but not having any luck so far! any ideas? thanks!

set test [string map [list + \0030,3+ - \0030,4-] $num]
set test2 [string map [list + \0030,3+ - \0030,4-] [lindex $all 3]]

putserv "PRIVMSG $channel :\0030,12»\0031,15 Nasdaq-100 Pre-Market Indicator > [lindex $all 0] $test ($test2) \0031,15 [lindex $all 1] ET \003"
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

what I'm trying to do is add a space of either the red or green colour infront of $test
Can you repeat this, it doesn't mean anything as it is.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

sorry - as I'm using a background colour, I want to pad the $test2 info either side with a space which just shows up as colour, like would show up if you did this:

/0030,12 Hello /003

rather than the text hard up against the edges of the colour like:

/0030,12Hello/003

so I'd like this to be either green or red depending on that string that determines the colour based on whether + or - is in $num

thanks - hope that makes it clearer...
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

Try using a hard space. ALT 0160 never tried it myself.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

thanks but that's not it - if anyone else has any ideas...
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
TeDDyBeeR
Voice
Posts: 21
Joined: Tue Sep 02, 2003 7:11 am

Post by TeDDyBeeR »

This is an example of i think you meen what you wanna have :

Code: Select all

set testnum "+123"
set testnum2 "-123"

bind pub - !testnum proc:doshow

proc proc:doshow {nick uhost handle channel arg} {
   global testnum testnum2
   putserv "PRIVMSG $channel : TEST"
   putserv "privmsg $channel : \0030,12»\0031,15 Nasdaq-100 Pre-Market Indicator > [expr $testnum<0?"\00304$testnum":"\00303$testnum"] \0031,15 ET \003]"
   putserv "privmsg $channel : \0030,12»\0031,15 Nasdaq-100 Pre-Market Indicator > [expr $testnum2<0?"\00304$testnum2":"\00303$testnum2"] \0031,15 ET \003]"
}
the code :

Code: Select all

[expr $testnum<0?"\00304$testnum":"\00303$testnum"]
In this line check of the $testnum is lower then 0 or not, when it is, he write in red, (-123) and else he write in green (+123)

I hope you have someting on this :)

regards,
TeDDyBeeR
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Re: inserting a space

Post by stdragon »

NewzBoy wrote:Hi - I have this string that adds colour to pieces of data before it's sent to the channel - what I'm trying to do is add a space of either the red or green colour infront of $test, but not having any luck so far! any ideas? thanks!

set test [string map [list + \0030,3+ - \0030,4-] $num]
set test2 [string map [list + \0030,3+ - \0030,4-] [lindex $all 3]]

putserv "PRIVMSG $channel :\0030,12»\0031,15 Nasdaq-100 Pre-Market Indicator > [lindex $all 0] $test ($test2) \0031,15 [lindex $all 1] ET \003"
Well, if you want to insert spaces, all you have to do is add them to the "string map" command.

string map [list + "\0030,3 +" - "\0030,4 -" ] $num

and in the putserv, add a space before the new \003.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

that works great - cheers stdragon!
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
Locked