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.

Splitting some strings

Old posts that have not been replied to for several years.
Locked
c
cvanmeer
Halfop
Posts: 40
Joined: Tue Dec 02, 2003 1:00 pm
Location: The Netherlands
Contact:

Splitting some strings

Post by cvanmeer »

I have the following code:

Code: Select all

proc where {nick host hand chan text} {
 package require http

  set token [http::config -useragent "Mozilla 4.0"]
  set temp [http::geturl $url]
  set data [http::data $temp]
.............
The result is this: {Pinkeltje} moc_fild17.gat 103 313 <br>{Shinji} prt_fild08.gat 127 308 <br>{Dwedarina} moc_fild04.gat 205 331 <br>{Nevermind} pay_fild01.gat 66 257 <br>{Valentino} prontera.gat 155 214 <br>

As you can see, there are 5 users with data and I want to split the entire string so that the output is like this:

{Pinkeltje} moc_fild17.gat 103 313
{Shinji} prt_fild08.gat 127 308
{Dwedarina} moc_fild04.gat 205 331
{Nevermind} pay_fild01.gat 66 257
{Valentino} prontera.gat 155 214

So I want to display all 5 lines to the user with the following:

Code: Select all

foreach line $data {
putquick "PRIVMSG $chan :$data" }
Or something like that....can somebody help me?

thx.
Chrizz
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Get the "package require http" outside the proc and try to [split $data \n]
Once the game is over, the king and the pawn go back in the same box.
c
cvanmeer
Halfop
Posts: 40
Joined: Tue Dec 02, 2003 1:00 pm
Location: The Netherlands
Contact:

Post by cvanmeer »

can't make it work :cry:
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Well here's a start for you..

Code: Select all

# http stuff goes here
regsub -all "<br>" $data "\n" data
set lines [split $data "\n"]
foreach line $lines {
  putserv "privmsg #sheep :$line"
}
Locked