hrm i guess this should probably be in that .zip too
H.Support.acs.cs
Code: Select all
// misc support functions for HPack
// part of Hpack version 0.3 by Han Nehi
// You have to pass the length of the %search and %replace strings
function HString::Replace(%string, %search, %replace, %search_len, %replace_len)
{
%s = 0;
while((%i = String::findSubStr(HString::getLongSubStr(%string, %s, 9999), %search)) != -1)
{
%string = HString::getLongSubStr(%string, 0, %i+%s) @ %replace @ HString::getLongSubStr(%string, %i+%s+%search_len, 9999);
%s += %i + %replace_len;
}
return %string;
}
// same as String::getSubStr, except without the 255 char limit
function HString::getLongSubStr(%string, %start, %len)
{
if( %len <= 255 )
return String::getSubStr(%string, %start, %len);
%s = 0;
while( String::getSubStr(%string, %start + %s, 1) != "" )
{
if( %len > 255 )
%l = 255;
else
%l = %len;
%ret = %ret @ String::getSubStr(%string, %start + %s, %l);
%s += 255;
%len -= 255;
}
return %ret;
}
// example: Hecho("var 1 is", %var1, "var 2 is", %var2);
function HEcho(%t0, %v0, %t1, %v1, %t2, %v2, %t3, %v3, %t4, %v4, %t5, %v5, %t6, %v6, %t7, %v7, %t8, %v8, %t9, %v9 )
{
%c = -1;
while( %t[%c++] != "" )
%txt = %txt @ " " @ %t[%c] @ ": '" @ %v[%c] @ "', ";
echo( HString::getLongSubStr(%txt, 0, 1023) );
}
// modified from Andrew's config options\init.cs
function HBindKey( %key, %action, %breakaction )
{
%key[0] = getword(%key, 0);
%key[1] = getword(%key, 1);
if (%key[1] != "")
%key = "\"" @ %key[0] @ "\", \"" @ %key[1] @ "\"";
else
%key = "\"" @ %key[0] @ "\"";
if( %action == "" )
%action = "$null='';";
if( %breakaction == "" )
%breakaction = "$null='';";
%bind = "bindCommand(keyboard0, make, " @ %key @ ", TO, \"" @ %action @ "\");";
eval( %bind );
%bind = "bindCommand(keyboard0, break, " @ %key @ ", TO, \"" @ %breakaction @ "\");";
eval( %bind );
}
sorry, most of my scripts these days are all kinda tied together thats why i haven't given one out in a while