mIRC Homepage
Posted By: Agent_Mike Variable Length - 17/09/03 06:31 PM
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
Posted By: r0ck0 Re: Variable Length - 17/09/03 06:39 PM
The limit is like 900 characters or somewhere around there.
Posted By: Agent_Mike Re: Variable Length - 17/09/03 06:53 PM
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?
Posted By: Collective Re: Variable Length - 17/09/03 06:54 PM
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.
Posted By: Agent_Mike Re: Variable Length - 17/09/03 07:27 PM
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?
Posted By: Agent_Mike Re: Variable Length - 17/09/03 07:34 PM
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
Posted By: mancontr Re: Variable Length - 18/09/03 12:38 AM
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)
Posted By: Agent_Mike Re: Variable Length - 18/09/03 04:07 AM
thank you, but i alread figured out how to do it using a text file, and this solution actually to my liking.
grin
© mIRC Discussion Forums