mIRC Home    About    Download    Register    News    Help

Print Thread
parsing this massive string #175630 26/04/07 12:15 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
Code:
alias test {
var %str = <tr id='find1'><td class=StyleTahoma valign=up>Dennie™</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=Dennie™"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=!!!!! CAFE MOJITO !!!!!'>!!!!! CAFE MOJITO !!!!!</a><br><a href='chatroom.php?rm=BCNTrivia'>BCNTrivia</a><br><a href='chatroom.php?rm=Jewels Place'>Jewels Place</a><br><a href='chatroom.php?rm=EspressoBar'>EspressoBar</a><br><a href='chatroom.php?rm=Leuteenergie'>Leuteenergie</a><br><a href='chatroom.php?rm=Scriptz Help'>Scriptz Help</a><br><a href='chatroom.php?rm=GrapevineEdge'>GrapevineEdge</a><br><a href='chatroom.php?rm=EspressoBar_2'>EspressoBar_2</a><br><a href='chatroom.php?rm=EspressoBar_3'>EspressoBar_3</a><br><a href='chatroom.php?rm=TienersHangout'>TienersHangout</a><br><a href='chatroom.php?rm=Chat Cafe'>Chat Cafe</a><br><a href='chatroom.php?rm=AfterHours'>AfterHours</a><br><a href='chatroom.php?rm=Liefde en Romantiek'>Liefde en Romantiek</a><br><a href='chatroom.php?rm=Babbelboxke'>Babbelboxke</a><br><a href='chatroom.php?rm=Trivia Room'>Trivia Room</a><br><a href='chatroom.php?rm=30plus'>30plus</a><br><a href='chatroom.php?rm=Scriptez-Domain'>Scriptez-Domain</a><br><a href='chatroom.php?rm=Tannies Poolbar'>Tannies Poolbar</a><br><a href='chatroom.php?rm=GrapevineEdge_2'>GrapevineEdge_2</a><br><a href='chatroom.php?rm=DragonsDomain'>DragonsDomain</a><br><a href='chatroom.php?rm=WebbyCove'>WebbyCove</a><br><a href='chatroom.php?rm=~ !!Blondes ~ Flirty ~ Chat !! ~'>~ !!Blondes ~ Flirty ~ Chat !! ~</a><br><a href='chatroom.php?rm=!!!!!!!!!!!!!!~FLIRTATIOUS~MINDS~'>!!!!!!!!!!!!!!~FLIRTATIOUS~MINDS~</a><br><a href='chatroom.php?rm=Gezellig-Limburgs'>Gezellig-Limburgs</a><br></td></tr></table>
}


how can i possibly parse something like this? i'm trying to get it to echo each rooms which the user is in - about 20 in the string, but its almost impossible with /set ling too long error

Last edited by pouncer; 26/04/07 12:15 AM.
Re: parsing this massive string [Re: pouncer] #175631 26/04/07 12:41 AM
Joined: Mar 2007
Posts: 60
S
Spitfire3292 Offline
Babel fish
Offline
Babel fish
S
Joined: Mar 2007
Posts: 60
Check out binary variables. Specifically make your sockread &var then use $bvar and $bfind to help yah get to a specific point in the string. Sorry I cant give more advice to you right now, I got to run! Hope I helped!


"In order to succeed, your desire for success should be greater than your fear of failure."
Re: parsing this massive string [Re: Spitfire3292] #175664 26/04/07 10:37 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
How about just FIXING the line length limit al together!


Beware of MeStinkBAD! He knows more than he actually does!
Re: parsing this massive string [Re: MeStinkBAD] #175672 26/04/07 12:33 PM
Joined: Feb 2005
Posts: 342
R
Rand Offline
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
That would be something Khaled would have to do. And I honestly don't see it happening any time soon.

Binary Variables are about the only way for you to specifically deal with extremely long lines.

Re: parsing this massive string [Re: Rand] #175685 26/04/07 08:59 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
can you guys give me a binvar example please on how to deal with it?

Re: parsing this massive string [Re: pouncer] #175845 29/04/07 05:05 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
please guys, anyone?

Re: parsing this massive string [Re: pouncer] #175853 29/04/07 06:27 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
Code:
alias getroom {
  if (!$bvar($1,0)) { return }
  var %pos = $bfind($1,1,?rm=) + 4
  while (%pos != 4) {
    echo -a $bvar($1,$+(%pos,-,$calc($bfind($1,%pos,') - 1))).text
    %pos = $bfind($1,%pos,?rm=) + 4
  }
}


You just have to pass the name of the binary variable you read the data into to /getroom. This just echos the rooms to the active window, you can change that to whatever you like.

Re: parsing this massive string [Re: hixxy] #175887 29/04/07 11:33 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
hey hixxy, your code worked an absolute treat!!! one other problem i have is if the search page contains rooms which found more than 1 user

e.g, if i search for 'dave' it finds, Swtdave, dave1981, etc.. and lists their rooms, how could i show this data also?

Code:
<tr id='find1'><td class=StyleTahoma valign=up>Swtdave</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=Swtdave"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=BBW Big Bold n Spicy'>BBW Big Bold n Spicy</a><br></td></tr><tr id='find2'><td class=StyleTahoma valign=up>BroDave</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=BroDave"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=Christians~Meeting~Christians'>Christians~Meeting~Christians</a><br></td></tr><tr id='find1'><td class=StyleTahoma valign=up>DaveFla</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=DaveFla"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=Natural Attire'>Natural Attire</a><br></td></tr><tr id='find2'><td class=StyleTahoma valign=up>Dave13733</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=Dave13733"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=Political Chat for Grownups'>Political Chat for Grownups</a><br></td></tr><tr id='find1'><td class=StyleTahoma valign=up>DANNYS_BOY_DAVE1939</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=DANNYS_BOY_DAVE1939"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=THE OLDER THAN DIRT ROOM'>THE OLDER THAN DIRT ROOM</a><br></td></tr></table>

Last edited by pouncer; 29/04/07 11:33 PM.
Re: parsing this massive string [Re: pouncer] #175900 30/04/07 10:59 AM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
It should already do that, since all it does is grab the text between every instance of ?rm= and '

Re: parsing this massive string [Re: hixxy] #175902 30/04/07 11:38 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
thanks for the reply hixy. yeah it displays all that every user is in

but doesnt dislay the username

Re: parsing this massive string [Re: pouncer] #175931 30/04/07 05:30 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
Code:
alias getroom {
  if (!$bvar($1,0)) { return }
  var %pos = $bfind($1,1,?name=) + 6, %pos2, %next
  while (%pos != 6) {
    %next = $iif($bfind($1,%pos,?name=),$v1,$bvar($1,0))
    echo -a Rooms for $bvar($1,$+(%pos,-,$calc($bfind($1,%pos,") - 1))).text $+ :
    %pos2 = $bfind($1,%pos,?rm=) + 4
    while (%pos2 != 4) && (%pos2 < %next) {
      echo -a $bvar($1,$+(%pos2,-,$calc($bfind($1,%pos2,') - 1))).text
      %pos2 = $bfind($1,%pos2,?rm=) + 4
    }
    %pos = $bfind($1,%pos,?name=) + 6
  }
}

Re: parsing this massive string [Re: hixxy] #175933 30/04/07 05:35 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
hixxy that alias is now perfect, thanks alot.

can i ask what the +6 and +4 are doing though?

Re: parsing this massive string [Re: pouncer] #175934 30/04/07 06:03 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
%pos is set to the occurrence of ?name=, which is six letters long, but we don't want to include that in the /echo, so we add 6 to it.

Same applies to %pos2, but ?rm= is only 4 long.

Re: parsing this massive string [Re: pouncer] #176074 02/05/07 01:39 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
hey hixxy, after testing it for a while, i've it sometimes displays the results wrong :s e.g

Code:
<tr id='find1'><td class=StyleTahoma valign=up>GardenBot1</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=GardenBot1"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=Garden Of Light'>Garden Of Light</a><br></td></tr><tr id='find2'><td class=StyleTahoma valign=up>IdentityCrisisBH</td><td class=StyleTahoma></td><td class=StyleTahoma><a href='chatroom.php?rm=Philochat'>Philochat</a><br></td></tr><tr id='find1'><td class=StyleTahoma valign=up>GoldenEagle</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=GoldenEagle"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=`The Round Table'>`The Round Table</a><br></td></tr><tr id='find2'><td class=StyleTahoma valign=up>Hidden™</td><td class=StyleTahoma></td><td class=StyleTahoma><a href='chatroom.php?rm=lebanon'>lebanon</a><br></td></tr><tr id='find1'><td class=StyleTahoma valign=up>dandenver</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=dandenver"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=wizetraders'>wizetraders</a><br></td></tr><tr id='find2'><td class=StyleTahoma valign=up>Arthur_Dent</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=Arthur_Dent"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=!!!!!The_Dark_Side!!!!!'>!!!!!The_Dark_Side!!!!!</a><br><a href='chatroom.php?rm=!!!!!!!!!!AMERICA!!!!!!!!!! ~ War On Terror! ~ News! ~ Politics!'>!!!!!!!!!!AMERICA!!!!!!!!!! ~ War On Terror! ~ News! ~ Politics!</a><br></td></tr><tr id='find1'><td class=StyleTahoma valign=up>Deco-Den</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=Deco-Den"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=Bi Married Men4Men'>Bi Married Men4Men</a><br><a href='chatroom.php?rm=!!!!!!!!!!!!!!!!!!!!!!!!!!!!5TR8_M3N_W_G@Y_URG35'>!!!!!!!!!!!!!!!!!!!!!!!!!!!!5TR8_M3N_W_G@Y_URG35</a><br><a href='chatroom.php?rm=!!!!!!!!!!!!!!!!!!!HOTT AND BOTHERED COME IN'>!!!!!!!!!!!!!!!!!!!HOTT AND BOTHERED COME IN</a><br></td></tr><tr id='find2'><td class=StyleTahoma valign=up>Golden</td><td class=StyleTahoma><a href="../members/usrProfile.php?name=Golden"><img border="0" src='../webincludes/icons/userNbr.gif'></a></td><td class=StyleTahoma><a href='chatroom.php?rm=Scriptez-Domain'>Scriptez-Domain</a><br><a href='chatroom.php?rm=InventioN'>InventioN</a><br><a href='chatroom.php?rm=!!!!!!!!!!!!!!~FLIRTATIOUS~MINDS~'>!!!!!!!!!!!!!!~FLIRTATIOUS~MINDS~</a><br><a href='chatroom.php?rm=Scripters'>Scripters</a><br><a href='chatroom.php?rm=hackers'>hackers</a><br></td></tr></table>


for e.g it displays:
Code:
Rooms for GardenBot1:
Garden Of Light
Philochat


which is wrong, because its the user 'IdentityCrisisBH' thats in PhiloChat.

any ideas mate?