mIRC Home    About    Download    Register    News    Help

Print Thread
#71929 18/02/04 04:23 PM
Joined: Aug 2003
Posts: 80
H
HM2K Offline OP
Babel fish
OP Offline
Babel fish
H
Joined: Aug 2003
Posts: 80
What is the max length for /set and what is the best way to deal with $1- if it is too long to set? (ie cutting down, etc)

Thanks.


-HM2K- hm2k.org
#71930 18/02/04 06:53 PM
Joined: Dec 2002
Posts: 102
M
Vogon poet
Offline
Vogon poet
M
Joined: Dec 2002
Posts: 102
I don't know for sure if there's a definite maximum, I think the value has other factors that determine the exact number of characters available. Generally speaking though it's 900+ characters.

The "best" way (in my opinion,) would be to not write code that could try to store that much information in variables. If you suspect a variable could require this much information, don't store it in a variable, use another storage mechanism instead. An example is trying to store a list of users in the channel. A variable is ok if it's a tiny channel but in a channel with 1000+ users the script is going to break very easily.

Hash tables, .ini files, text files, binary files, binary variables, and user levels are other storage mechanisms that may work better depeding on the script requirements.

Of course if you insist on using a traditional variable you can check the length (with $len()) of the data before storing it and come up with some way to split your variable (usually people that do it this way do so by creating another variable name %variablename2 or similar) to store the data.


-
MIMP
#71931 18/02/04 07:40 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
To be exact - variable name + value can be a max of 945 characters combined.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#71932 18/02/04 08:01 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
The length of the /command (and switches, etc) is also included.

#71933 19/02/04 04:37 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
oddly you can use $1- being over 945 as long as you dont end up with a result over 945, (or 9?? what ever it is )

I had a script where i went something like.

blah {
var %qwe = $1-
;later on
var %g $remove(%qwe %qwe,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z)
}

it failed but...
var %g $remove($1- $1- ,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z)

worked fine.

PS: it was something like that, dont quote me on that exactly.

#71934 20/02/04 11:44 AM
Joined: Aug 2003
Posts: 80
H
HM2K Offline OP
Babel fish
OP Offline
Babel fish
H
Joined: Aug 2003
Posts: 80
what exactly does that do?

I don't actually understand what that does...

I got a html stripper, let me post a copy.

Code:
alias striphtml {
  if ($1) {
    var %strip,%parm = <> $remove($1-,> <,><,$chr(9)) <>,%n = 2
    while ($gettok($gettok(%parm,%n,62),1,60)) {
      %strip = %strip $ifmatch
      inc %n
    }
    return %strip
  }
} 


How would I mpliment that into my script, so that it will not give me the error "* /set: line too long" or such.

Thanks.


-HM2K- hm2k.org
#71935 23/03/04 06:18 PM
Joined: Aug 2003
Posts: 80
H
HM2K Offline OP
Babel fish
OP Offline
Babel fish
H
Joined: Aug 2003
Posts: 80
I know this is an old post, but I still have not resolved this problem... Anyone?


-HM2K- hm2k.org
#71936 27/01/06 06:19 PM
Joined: Aug 2003
Posts: 80
H
HM2K Offline OP
Babel fish
OP Offline
Babel fish
H
Joined: Aug 2003
Posts: 80
I'm still having issues with this. Still no solution.

Anyone up for the challange?


-HM2K- hm2k.org
#71937 27/01/06 06:26 PM
Joined: Jan 2003
Posts: 249
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Jan 2003
Posts: 249
you could use binary vars which are now unlimited and cut it into pieces at tag boundaries which don't exceed the maximum length of 900 chars (or cut it at 900 if no tag is available in the next 900 chars, for example along paragraph of text)

You can manipulate each chunk as you cut it out from the binary var.


Link Copied to Clipboard