mIRC Home    About    Download    Register    News    Help

Print Thread
Variable Length #49894 17/09/03 06:31 PM
Joined: Sep 2003
Posts: 17
A
Agent_Mike Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Sep 2003
Posts: 17
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

Re: Variable Length #49895 17/09/03 06:39 PM
Joined: Jun 2003
Posts: 242
R
r0ck0 Offline
Fjord artisan
Offline
Fjord artisan
R
Joined: Jun 2003
Posts: 242
The limit is like 900 characters or somewhere around there.

Re: Variable Length #49896 17/09/03 06:53 PM
Joined: Sep 2003
Posts: 17
A
Agent_Mike Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Sep 2003
Posts: 17
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?

Re: Variable Length #49897 17/09/03 06:54 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
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.

Re: Variable Length #49898 17/09/03 07:27 PM
Joined: Sep 2003
Posts: 17
A
Agent_Mike Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Sep 2003
Posts: 17
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?

Re: Variable Length #49899 17/09/03 07:34 PM
Joined: Sep 2003
Posts: 17
A
Agent_Mike Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Sep 2003
Posts: 17
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

Re: Variable Length #49900 18/09/03 12:38 AM
Joined: Sep 2003
Posts: 8
M
mancontr Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
M
Joined: Sep 2003
Posts: 8
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)

Re: Variable Length #49901 18/09/03 04:07 AM
Joined: Sep 2003
Posts: 17
A
Agent_Mike Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Sep 2003
Posts: 17
thank you, but i alread figured out how to do it using a text file, and this solution actually to my liking.
grin