mIRC Home    About    Download    Register    News    Help

Print Thread
#71725 17/02/04 06:36 PM
Joined: Jan 2004
Posts: 24
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jan 2004
Posts: 24
I thought this would come in very handy, so I whipped it up in my spare time.

$table(data)//Usethattocallthealias.

Thedatashouldbeformattedinthismanner:
Name[td]Address[td]City[td]Phone[tr]teh-awpZor[td]#script[td]GameSurge[td]1-800-GETALIFE
where[td]meansnewcolumnand[tr]meansnewrow.

[td][td][td][td]
[tr]NameAddressCityPhone

[tr]teh-awpZor#scriptGameSurge1-800-GETALIFE

Theinformationreturnedwilllooklikethis:
NameAddressCityPhone[tr]teh-awpZor#scriptGameSurge1-800-GETALIFE
whichwhenbrokendownwillbe:
NameAddressCityPhone
teh-awpZor#scriptGameSurge1-800-GETALIFE


aliastable{
;//Changes[tr]and[td]intosingle,easiliydistinguishedcharacters
var%i=$replace($remove($1-,$chr(157),$chr(158)),[tr],$chr(157),[td],$chr(158))
;//Establishesthelengthfor9columns
var%col=000000000
var%x=0
;//Establishesthelongestpossiblelengthforeachcolumn.
while(%x<$gettok(%i,0,157)){
inc%x|var%y=0
while(%y<$gettok($gettok(%i,%x,157),0,158)){
inc%y
if($len($gettok($gettok(%i,%x,157),%y,158))>$gettok(%col,%y,32))var%col=$puttok(%col,$($len($gettok($gettok(%i,%x,157),%y,158))),%y,32)
}
}
;//Modifiesthelengthofeachcolumnineachrowtobeexacttoothercellsinthesamecolumn.Thenexpandsthosecolumnlengthsby2non-breakingcharacters.
var%x=0
while(%x<$gettok(%i,0,157)){
inc%x|var%y=0|var%z=$gettok(%i,%x,157)
while(%y<$gettok($gettok(%i,%x,157),0,158)){
inc%y
var%c=$calc($gettok(%col,%y,32)-$len($gettok($gettok(%i,%x,157),%y,158))+2)
var%z=$puttok(%z,$($gettok(%z,%y,158)$+$str($chr(160),%c)),%y,158)
}
var%i=$puttok(%i,%z,%x,157)
}
;//Removesunnecessary[tr]markers.
var%i=$iif($left(%i,1)==$chr(157),$right(%i,-1),%i)|var%i=$iif($right(%i,1)==$chr(157),$left(%i,-1),%i)
;//Replaces[tr]substitutecharacterswith'[tr]'
return$remove($replace(%i,$chr(157),[tr]),$chr(158))
}

*Note:Donotpassasciicharacter157OR158throughthealias,youwon'tgetthemback:o.
*Note:ThealiaswillworkforUPTO9rows.Ifyoufeelyou'llneedmoreaddmore0'stovar%colseparatedbyaspace.e.g.'00000'

<teh-awpZor>yep,Ilikeit.Hopeyoudotoo.


<]dD[Makaveli> where can i get a clanboy (08:57 pm) <]dD[Makaveli> clanbot
#71726 17/02/04 09:47 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
only works on fixed width fonts.

#71727 24/02/04 12:07 AM
Joined: Jan 2004
Posts: 24
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jan 2004
Posts: 24
This maybe tru, I haven't tested it against other fonts, however I would assume that chr(160) would consume the same character size as other fonts within a font group


<]dD[Makaveli> where can i get a clanboy (08:57 pm) <]dD[Makaveli> clanbot
#71728 24/02/04 10:18 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
The font image for the letter I and W are different widths in most fonts, so using $chr(160) which is normally a space, well only result in x number of spaces, which wont equal the width of the text, it might be wider or skinnier, dependent on the font used for the text,

aka, well only work with fixed width fonts, font that have the same width for each character.

#71729 28/02/04 08:27 PM
Joined: Jan 2004
Posts: 24
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jan 2004
Posts: 24
understood, and thanx for the insight laugh

This cannot be fixed unless the much more coding is added to evaulate the lengths of the strings accoring to the font specified and the characters present. Needless to say I won't be doing that however, as for making all the strings similar lengths in characters, the script does exactly that. Sorry to anyone who looked foward to using this and have encountered any problems. If you find a permanent fix :x be sure to post it.

imo however that'll require a lot of math.


<]dD[Makaveli> where can i get a clanboy (08:57 pm) <]dD[Makaveli> clanbot
#71730 01/03/04 11:12 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
thats what $width is for (also see $wrap)


Link Copied to Clipboard