|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Tue Apr 30, 2002 6:03 pm
Quick(but not simple) Question(s) |
Heya! I'm trying to decern if its possible to put color into my #PICK window. Right now, it comes up with three field per row from my DB, seperated by ' - ' and its kinda hard to find a specific part I may be looking for.I'd like to be able to color each indiviual 'field' so as to make it easier to see when a field ends and where it begins.
If thats not possible, maybe a way to format it so the instead of looking like this:
The murderer - Sunset - Underdark
Mutant beastly fido - Market Square - Midgaard
Mota - Temple Square - Midgaard
[Ok] [Cancel]
it looked more like this:
The murderer - Sunset - Underdark
Mutant beastly fido - Market Square - Midgaard
Mota - Temple Square - Midgaard
[Ok] [Cancel]
Either way is fine for me, as long as its easier to see. Here is what the affected portion of the pick window looks like:
#FORALL %find( "%1") {#VAR moblist %concat( @moblist, "|", %db( %dbget( %i), "Name"), " - ", %db( %dbget( %i), "Room"), " - ", %db( %dbget( %i), "Area"), ":#EXEC ", %db( %dbget( %i), "SpeedW"))}
#PICK @moblist
Thanks in advance for any help, or input |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Apr 30, 2002 7:01 pm |
Nope, it's not possible to put color in your #PICK window. I tried to and all it did for me was have the %ansi() function show up in the picklist (ie, '%ansi(yellow)door' instead of 'door').
As far as the other thing goes, so long as you're using a fixed-width font you should be able to simply pad your fields with spaces.
About the only way I can see to go about this would be to use an alias as a subroutine:
#alias pad {#VARIABLE Spaces "";#while (%len(@spaces) <= %eval(@fieldlength - %len(%-1)) {#VARIABLE Spaces %concat(@Spaces," ")}}
You'd then have to concatenate your field with the @Spaces variable and figure out a way to correctly insert the dashes (might want to prepend them to the field):
#VARIABLE picklist %concat(@picklist,@spaces)
li'l shmoe of Dragon's Gate MUD |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Apr 30, 2002 7:15 pm |
Try the format function.
#FORALL %find( "%1") {#ADDITEM moblist %concat(%format("&27s",%db( %dbget( %i), "Name")), " - ", %format("&22s",%db( %dbget( %i), "Room")), " - ", %format("&22s",%db( %dbget( %i), "Area")), ":#EXEC ", %db( %dbget( %i), "SpeedW"))}
This will right-align the columns, instead of the left-align you wanted, but should still be easy to read.
LightBulb
Vague questions get vague answers |
|
|
|
Sildaren Wanderer
Joined: 19 Jul 2001 Posts: 59 Location: Germany
|
Posted: Tue Apr 30, 2002 8:22 pm |
For a left-aligned output you can use a user definded function:
#FUNC pad {%left(%concat(%2,%repeat(" ",%1)),%1)}
now
#SH @pad(10,Mota) - @pad(15,Temple Square)
displays
Mota - Temple Square
and
#FORALL %find( "%1") {#ADDITEM moblist %concat(@pad(27,%db( %dbget( %i), "Name")), " - ", @pad(22,%db( %dbget( %i), "Room")), " - ", @pad(22,%db( %dbget( %i), "Area")), ":#EXEC ", %db( %dbget( %i), "SpeedW"))}
should do what Lightbulb's suggestion does,
just with other align.
(only tested without database functions) |
|
|
|
Sildaren Wanderer
Joined: 19 Jul 2001 Posts: 59 Location: Germany
|
Posted: Tue Apr 30, 2002 8:28 pm |
Forum code tricked me by remove the spacing
Of course
#SH @pad(10,Mota) - @pad(15,Temple Square)
displaysMota - Temple Square |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Wed May 01, 2002 1:54 am |
Well, I tried both ways, and they both help me see MUCH better than it was when it was all jammed up together, I just need to figure out why they arent aligning correctly.
They are definately are formating, though Sildaren's method is considerably cleaner than Lightbulb's, it still isnt 100%. Exa:
Jarre - Common Room - Underdark
Drevlin - Inn Room - Underdark
I dont quite understand why it isnt using a fixed width...I had to change the parameters in my script from 27/22/22 to 30/30/30, just so the some of the names would fit, but other than that, I used Sildaren's copy verbatum.Notice that though the name Drevlin is 2 characters longer than Jarre , the next field is only misplaced by 1 character.And though there is a 3 character difference between the room names, there is still only a 1 character difference in the next field.*scratches his head* make any sense?Ths particular example isnt to bad, but when you get 30+ mobs/room names/areas in one pick window, it looks pretty messy
Any idea why its doing this? Thanks Lightbulb and Sildaren |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Wed May 01, 2002 4:21 am |
My guess is you have duplicate @pad() functions and you are using the wrong one.
|
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Wed May 01, 2002 4:34 am |
quote:
My guess is you have duplicate @pad() functions and you are using the wrong one.
Come again? I only created 1 @pad function(verbatum for what Sildaren posted), and i use it only 3 times, in the same script. If you are suggesting I use @pad(30) ,@pad(31) ,@pad(32) , I just tried that, and there was no difference.
Could you please be more specific as to what you mean? |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Wed May 01, 2002 4:54 am |
I'm just saying that perhaps you have one other '#FUNC pad {}' hidden somewhere in your script.
In the settings window, filter on Name, or Name and Values and enter 'pad' and click to filter. It should display script entries in all classes with the string 'pad' in them. |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Wed May 01, 2002 5:05 am |
Nope, I filtered in both Name and Value, and the only things that showed up where the pad variable and the alias that calls the @pad.
Furthermore I can do this:
#SH @pad(20, Mota) - @pad(20, Temple Square) - @pad(20, Midgaard)%{crlf}@pad(20, Jarre) - @pad(20, Common Room) - @pad(20,Underdark)
and have it show this:
Mota - Temple Square - Midgaard
Jarre - Common Room - Underdark
So I'm not certain what exaxtly the problem is, other than maybe it has something to do with the #ADDITEM not being able to cope with all the fields...*sigh* |
|
|
|
Sildaren Wanderer
Joined: 19 Jul 2001 Posts: 59 Location: Germany
|
Posted: Wed May 01, 2002 8:06 am |
Try a
#FORALL @moblist {#SH %i}
and you'll most likely see that the right number of spaces are insterted IF a font with fixed character width is used.
Unfortunatly the #PICK window uses a proportional font.
As far as I know you can't change it at all. At least not from within zMUD.
You can probably #MXP commands as workaround, but it looks like that will solve one problem while causing two new ones.
(If you use MXP in your main window you mess up your screen, and if you use a secondary window
you get problems sending commands back to your main character window) |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Wed May 01, 2002 12:15 pm |
Indeed, you are correct, #FORALL @mmoblist {#SH %i} does present it all in the correct format. Kinda lame that I cant change the font for the pick window. Gonna post a suggestion in the Beta Forum for this change.
Thanks for the help guys! |
|
|
|
|
|
|
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
|
|