mIRC Home    About    Download    Register    News    Help

Print Thread
#49894 17/09/03 06:31 PM
A
Agent_Mike
Agent_Mike
A
Ii've made a script that uses sockets to get information from a game server (America's Army) and when i get a reply from the server and store it in a variable, 2 things getting wrong.
  • When i look in the variable page in the script editor, not all of the information is there, it's kinda "cut off".
  • When i want to echo this variable, it says:
    Code:
     * /echo: line too long (line 20, script1.mrc) 


So I was wondering if the variables got any length limit or something of that kind, and how can my problem be solved.

I already tried looking in the help file and searching in the forum and couldn't find anything about it.

-- Michael

#49895 17/09/03 06:39 PM
R
r0ck0
r0ck0
R
The limit is like 900 characters or somewhere around there.

#49896 17/09/03 06:53 PM
A
Agent_Mike
Agent_Mike
A
means the variable got over that limit...ouch, i've now checked the length of that variable, and it's 949 charcters long, i'm guessing that's the limit.

do you have any ideas maybe on how can i split it when i'm recieving it from the server?

#49897 17/09/03 06:54 PM
Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
Save the text to a binary variable using /sockread and then use a loop with $bvar to put 900 chars in a normal variable at a time.

#49898 17/09/03 07:27 PM
A
Agent_Mike
Agent_Mike
A
yea, that seems as the solution to the riddle, but when i tried to copy from the binvar to a regular variable i got mixed up, can you maybe give me a tip with that?

#49899 17/09/03 07:34 PM
A
Agent_Mike
Agent_Mike
A
actually after messing around with it some more, i got it to export it to a txt file
Code:
  
bwrite aascan.txt 1 -1 &aascan 

I think from now i'll be able to work with it better (unless you have some better ideas)

thank you r0ck0 and Collective for your help.

-- Mike

#49900 18/09/03 12:38 AM
M
mancontr
mancontr
M
You can use something like this:
Code:
  var %c -1
  while ($calc(%c * 900) < $bvar(&binvar,0)) {
    inc %c
   %something_ [ $+ [ %c ] ] = $bvar(&binvar,$calc(%c * 900 + 1),899).text
  }

(sorry if there's any bug in the code, here it's the 02:36AM...i'm very sleepy crazy)

#49901 18/09/03 04:07 AM
A
Agent_Mike
Agent_Mike
A
thank you, but i alread figured out how to do it using a text file, and this solution actually to my liking.
grin


Link Copied to Clipboard