 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4813 Location: Pensacola, FL, USA
|
Posted: Sun Apr 11, 2004 12:10 am
#SUB |
is there a way i can force text to start on a specific column number so that my rows line up evenly? I have the following class to capture skills and modify it to what i want to see, but everything is squashed together.
#CLASS {Skills Formatting}
#TRIGGER {Unarmed Combat%s(%d)%s~| Thrown Weapons%s(%d)} {#SUB {Unarmed Combat %eval( @base+10-%1) ~(%eval( @base+10)~) %1 ~| Thrown Weapons %eval( @base+15-%2) ~(%eval( @base+15)~) %2}}
#TRIGGER {Tactics%s(%d)%s~| Stealth%s(%d)} {#SUB {Tactics %eval( @base+10-%1) ~(%eval( @base+10)~) %1 ~| Stealth %eval( @base+20-%2) ~(%eval( @base+20)~) %2}}
#TRIGGER {Sorcery%s(%d)%s~| Shields%s(%d)} {#SUB {Sorcery %eval( @base-%1) ~(%eval( @base)~) %1 ~| Shields %eval( @base+5-%2) ~(%eval( @base+5)~) %2}}
#TRIGGER {Shady Behavior%s(%d)%s~| Polearm Weapons%s(%d)} {#SUB {Shady Behavior %eval( @base+5-%1) ~(%eval( @base+5)~) %1 ~| Polearm Weapons %eval( @base-%2) ~(%eval( @base)~) %2}}
#TRIGGER {Outdoorsman%s( %d)%s~| Observation%s( %d)} {#SUB {Outdoorsman %eval( @base+20-%1) ~(%eval( @base+20)~) %1 ~| Observation %eval( @base+20-%2) ~(%eval( @base+20)~) %2}}
#TRIGGER {Mechanisms%s( %d)%s~| Maintenance%s( %d)} {#SUB {Mechanisms %eval( @base-%1) ~(%eval( @base)~) %1 ~| Maintenance %eval( @base-%2) ~(%eval( @base)~) %2}}
#TRIGGER {Lore%s( %d)%s~| Lockpicking%s( %d)} {#SUB {Lore %eval( @base-%1) ~(%eval( @base)~) %1 ~| Lockpicking %eval( @base-%2) ~(%eval( @base)~) %2}}
#TRIGGER {Knives and Rapiers%s( %d)%s~| Kinesis%s( %d)} {#SUB {Knives and Rapiers %eval( @base+15-%1) ~(%eval( @base+15)~) %1 ~| Kinesis %eval( @base-%2) ~(%eval( @base)~) %2}}
#TRIGGER {Focus%s( %d)%s~| First Aid%s( %d)} {#SUB {Focus %eval( @base-%1) ~(%eval( @base)~) %1 ~| First Aid %eval( @base+10-%2) ~(%eval( @base+10)~) %2}}
#TRIGGER {Evasion and Dodging%s( %d)%s~| Essence Store%s( %d)} {#SUB {Evasion and Dodging %eval( @base+15-%1) ~(%eval( @base+15)~) %1 ~| Essence Store %eval( @base+10-%2) ~(%eval( @base+10)~) %2}}
#TRIGGER {Crushing Weapons%s( %d)%s~| Conditioning%s( %d)} {#SUB {Crushing Weapons %eval( @base+5-%1) ~(%eval( @base+5)~) %1 ~| Conditioning %eval( @base+20-%2) ~(%eval( @base+20)~) %2}}
#TRIGGER {Channeling%s( %d)%s~| Bladed Weapons%s( %d)} {#SUB {Channeling %eval( @base+15-%1) ~(%eval( @base+15)~) %1 ~| Bladed Weapons %eval( @base+15-%2) ~(%eval( @base+15)~) %2}}
#TRIGGER {Axes%s( %d)%s~| Armor%s( %d)} {#SUB {Axes %eval( @base-%1) ~(%eval( @base)~) %1 ~| Armor %eval( @base-%2) ~(%eval( @base)~) %2}}
#TRIGGER {Archery%s( %d)%s~| Animal Handling%s( %d)} {#SUB {Archery %eval( @base+25-%1) ~(%eval( @base+25)~) %1 ~| Animal Handling %eval( @base+20-%2) ~(%eval( @base+20)~) %2}}
#TRIGGER {Trainings: (%d)} {base = %eval( %1*10)}
#CLASS 0 |
|
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sun Apr 11, 2004 2:47 am |
A workaround rather than a fix - inserting a certain amount of a variable containing only spaces (using the %left() function I'd guess) could do the job you're after.
So if you need it to begin 5 characters along then create a variable with, say, 10 spaces in it. then...
#say %left(@tenspaces,5) Test
And test appears 5 spaces in.
Could probably use %len() to automatically cut short the tenspaces variable to the required length.
Guinn |
|
|
|
 |
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Sun Apr 11, 2004 2:48 am |
Yep, lets say you have 3 columns of information you want to display the first column you would like to be up to 20 characters long, the 2nd up to 15 characters and the 3rd you want up to 10 characters but you also want the 3rd column right aligned. Like so..
| Code: |
MudName CharName Level
Nightmares Jolie 10
BadMud Wacko 2
|
So you would write an alias to display data like this:
| Code: |
#alias formatline {#show %1%repeat(" ",20-%len(%1))%2%repeat(" ",15-%len(%2))%repeat(" ",10-%len(%3))%3}
and make calls to it like this
formatline "MudName" "CharName" "Level"
formatline "Nightmares" "Jolie" "10"
|
now in your case your doing substitutes so you could write a function that the substitute uses to format your data, just use the same idea DATASTRING%repeat(" ", COLUMNWIDTH - LENGTHOFSTRINGYOURPRINTING) if you want it right aligned %repeat would go before the DATASTRING
cheers, jesse |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4813 Location: Pensacola, FL, USA
|
Posted: Sun Apr 11, 2004 4:19 am |
Ok, that would work but at some point my skills will get to a point where alignment will get screwy and needining to go back into it to fix, and was hoping to bypass that by telling it right where i want it to start, following is the output i get from the above script:
Unarmed Combat 38 (570) 532 | Thrown Weapons 15 (575) 560
Tactics 133 (570) 437 | Stealth 287 (580) 293
Sorcery 413 (560) 147 | Shields 473 (565) 92
Shady Behavior 23 (565) 542 | Polearm Weapons 560 (560) 0
Outdoorsman 41 (580) 539 | Observation 8 (580) 572
Mechanisms 307 (560) 253 | Maintenance 560 (560) 0
Lore 560 (560) 0 | Lockpicking 17 (560) 543
Knives and Rapiers 9 (575) 566 | Kinesis 560 (560) 0
Focus 560 (560) 0 | First Aid 570 (570) 0
Evasion and Dodging 5 (575) 570 | Essence Store 568 (570) 2
Crushing Weapons 532 (565) 33 | Conditioning 15 (580) 565
Channeling 570 (575) 5 | Bladed Weapons 199 (575) 376
Axes 560 (560) 0 | Armor 18 (560) 542
Archery 471 (585) 114 | Animal Handling 93 (580) 487
the trick is in geting it to account for the length of each number so 1's, 10's, 100's and 1000's continue to line up as i grow.. |
|
|
|
 |
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Sun Apr 11, 2004 4:49 am |
Yep thats what i was saying you know you want the numbers, im assuming up to 4 digits. Now i rewrote this even easier to do the whole line with
%format() (forgot about this).
Heres an example with one of your triggers and the formatting function
| Code: |
#FUNCTION doformat {%format("&-25s &4.0f (&4.0f) &4.0f| &-25s &4.0f (&4.0f) &4.0f",%1,%2,%3,%4,%5,%6,%7,%8)}
#TRIGGER {Unarmed Combat%s(%d)%s~| Thrown Weapons%s(%d)} {#SUB {@doformat(Unarmed Combat,%eval( @base+10-%1),%eval( @base+10), %1,Thrown Weapons,%eval( @base+15-%2),%eval( @base+15),%2)}}
|
the format function says first a string column with width -25, negative because you want it left aligned, next is a floating point
number with a width a 4 right-aligned and no decimal places, next is the same but display it in parentheses ..etc
quickly glanced , but all your triggers seem to want that same format
this way you can just change this doformat function if you ever want
to changed how there displayed (add color etc) you only have to mess with the doformat function and not each invidual trigger
Jesse |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4813 Location: Pensacola, FL, USA
|
Posted: Sun Apr 11, 2004 8:28 am |
perfect, thanks a heap
|
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Apr 11, 2004 4:27 pm |
jessew
Not everyone has a screen which is over 1500 pixels wide. I'd
appreciate if you'd stop using the [code] and
[/code] tags. They mess up the forum and make it extremely
difficult to read not only your posts, but every post in the thread.
There's a reason the forum has a built-in wordwrap function. |
|
|
|
 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|