|
Joined: Mar 2003
Posts: 31
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 31 |
i have a really weird prob i do a normal sockread, only echoing der variable i read in and it returns the following: <td colspan="1" nowrap><select class='mini' name='GameTypeSelect'><option value="XGame.xBombingRun">Bombing Run</option><option value="XGame.xCTFGame">Capture the Flag</option><option value="XGame.xDeathMatch" selected>DeathMatch</option><option value="XGame.xDoubleDom">Double Domination</option><option value="Excessive.ExcessiveBR">Excessive Bombing Run</option><option value="Excessive.ExcessiveCTF">Excessive Capture The Flag</option><option value="Excessive.ExcessiveDM">Excessive Death Match</option><option value="Excessive.ExcessiveDD">Excessive Double Domination</option><option value="Excessive.ExcessiveTDM">Excessive Team Death Match</option><option value="SkaarjPack.Invasion">Invasion</option><option value="BonusPack.xLastManStandingGame">Last Man Standing</option><option value="BonusPack.xMutantGame">Mutant</option><option value="Rocketeer084b.RocketeerGame">Rocketeer 2003</option>[color:red]<option value="XGame.xTe
thmatch</option>[/color]</select> instead of: ... [color:red]<option value="XGame.xTeamGame" selected>Team Deathmatch</option>[/color] ... i examined the packages i received, but there was everything ok so mirc cuts out some characters and put a $crlf instead i really cant figure out why
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Did you remember that you must call sockread from within a loop? Meaning, a single sockread is not guaranteed to read all the data. Something like: (taken from the helpfile but modified to use local variables and a while() loop)
on 1:sockread:testing:{
var %temp
if ($sockerr > 0)
return
while ($true) {
sockread %temp
if ($sockbr == 0)
break
if (%temp == $null)
break
echo %temp
}
}
|
|
|
|
Joined: Mar 2003
Posts: 31
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 31 |
yes, i know, but i didnt want to post the whole html file the event is triggered several times before and after this line to be sure, i also tested your solution, but it didnt help it strongly seems to me that it is a mirc bug
|
|
|
|
Joined: Dec 2002
Posts: 44
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 44 |
This is not a mIRC bug.
mIRC is limited in the length it will store in a variable.
As such, mIRC will fill it up, and as such, it wraps at the point where you claim the bug is produced.
It is up to the script (you) to deal with search, replace, dis/asembly of the incoming text.
Suck it, lick it, milk it then put it away.
|
|
|
|
Joined: Mar 2003
Posts: 31
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 31 |
i couldnt find a note describing a limitation on variables and this is not the first time this happened the last time the line was only about 10 chars long and if it is a limitation, how can i workaround it? what else can i do than letting sockread write into a variable? do i have to use a binvar which is really not very useful at this point?
|
|
|
|
Joined: Dec 2002
Posts: 44
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 44 |
Parse the incoming text, and work out once the string is complete.
Binvars will not help in any way, when reading this sort of text.
Suck it, lick it, milk it then put it away.
|
|
|
|
Joined: Mar 2003
Posts: 31
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 31 |
ok, and where can i get the missing 25 characters?
|
|
|
|
Joined: Dec 2002
Posts: 44
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 44 |
Use the "numbytes" parameter to limit the amount of bytes read from the socket
EG, use 20
THis will prevent over-filling of variables.
Suck it, lick it, milk it then put it away.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
I would suggest you take a look at binary variables.
|
|
|
|
Joined: Mar 2003
Posts: 31
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 31 |
numbytes only works with binvars i know how to use binvars, but that would be a very ugly solution
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
You should really always use binvars when reading from a socket. So it wouldn't be an ugly solution, it would be a correct solution.
|
|
|
|
Joined: Mar 2003
Posts: 31
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 31 |
correct solutions are only seldom the best solution ok, now i use binvars and it works, but the the size of the script is doubled and it is much more harder to read it not what i really wanted to but thx anyway
seems to be really a limitation to string variables should be noted in the help file
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Ok then fine, come up with some other hack that will barely work and will provide confusion code. Me? Well I'd rather use correct well structured code that works in all circumstances. For example, mIRC strips a trailinf $crlf, well what if this were inside a tag say <textarea> where a $crlf is important? Using regular variables, your data is now invalid and corrupt, using binary variables it continues to work perfectly.
|
|
|
|
Joined: Mar 2003
Posts: 31
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 31 |
i didnt say that vars are always better than binvars but in my case it is, because the code structure became worse btw the line doesnt contain a $crlf so the only problem was the string limitation i didnt know before same problem when reading over 4k data into a binvar, except that mirc cuts out some chars from the string
but now it works, so thx to all for help
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
But the 4k limit on binvars is not a hardlimit, you can easily change it using the "numbytes" parameter of sockread.
|
|
|
|
Joined: Mar 2003
Posts: 3
Self-satisified door
|
Self-satisified door
Joined: Mar 2003
Posts: 3 |
I can say that this is not a long msg trouble. If the string is too long the script which echoes the string will be halted with this error msg: - * String too long: Somthing - It's not a bug, mirc returns what the net (or the socket) sends it! I hope I was clear, ZaC a.k.a. KiTiK
|
|
|
|
Joined: Mar 2003
Posts: 31
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 31 |
this error msg occurs only if i sockread into a binvar und then copy the content to a string var but when you directly sockread into a var, no error msg comes up, only some chars missing, nothing else and i proved with a sniffer what exactly was sent to mirc i think the sockread command could be optimized to trigger an error msg if this happens or just dont cuts out chars anymore
|
|
|
|
|