Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
ravin
Newbie


Joined: 13 Nov 2000
Posts: 6

PostPosted: Sun Dec 16, 2001 9:22 am   

Formatting open spaces for variables
 
I am going in circles here trying to figure this out. I need a way to hold a space between characters for screen formatting purposes. The space needs to be a min of 2 characters, even when the variable is only 1 character. The tricky part is that the variables are enclosed in () as part of the screen formatting. What I need the product to look like is:

         ( 0)             (**)

/ 0| 0| 0 / 0| 0| 0 ( 0/ || 0)
/ / ( 0/ 0)


but as close as I can get is:

         (0)          (**)

/0|0|0 /0|0|0 (0/ || \0)
/ / (0/ \0)


As you can see, I cannot figure out how to get the extra space for formatting purposes.

The string is:

%format [space(9)](%cg%ch%format(@DGH)%cn)[space(10)](**)%r[space(6)]/%cg%ch%format(@DGLT)%cn|%cg%ch%format(@DGCT)%cn|%cg%ch%format(@DGRT)%cn%[space(6)] /%cg%ch%format(@DGLTR)%cn|%cg%ch%format(@DGCTR)%cn|%cg%ch%format(@DGRTR)%cn%[space(4)]%r[space(5)](%cg%ch%format(@DGLA)%cn/ || %%cg%ch%format(@DGRA)%cn%)%r[space(7)]/[space(2)]/%[space(2)]%%r[space(6)](%cg%ch%format(@DGLL)%cn/[space(2)]%%cg%ch%format(@DGRL)%cn)%r%r

the %r is carriage return, %cg%ch are ANSI colors.

Thanks for any help, and let me know if more clarification is required.


**Edit to make the spaces show correctly**

Edited by - iljhar on 12/16/2001 12:56:28
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Sun Dec 16, 2001 8:12 pm   
 
Where are you getting %cg, %ch, and %r? Are those mud variables because I can't find them in zMUD, maybe I'm just not looking in the right place. In any case, the variables that you get, @DGH, @DGLT, etc. are those numbers or strings? I may have a way to do it if you can answer the questions. :)

Edit: Is this supposed to be a stick figure type model? The variables telling you about your head, torso, arms and legs?

Iljhar
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Dec 16, 2001 10:24 pm   
 
I held off on responding to this until I could get a better idea what you want to do.
As iljhar said I can't find some of what you got in the help so I am clueless about it.
However it would apprear that your variable references are encapsulated by thier own format function as such I think I can help...replace all your formats that hold a variable (ie "%format(@DGRL)") with %format("&2s",@Variable). The &2s comes right out of the help file for format.
Reply with quote
ravin
Newbie


Joined: 13 Nov 2000
Posts: 6

PostPosted: Mon Dec 17, 2001 5:12 am   
 
Iljar is dead on. It is a stick figure and the variables are for the parts of the figure.

And I thought Vijilante had it solved, for when I copy/pasted the %format("&2s",@Variable) and ran the alias, it worked! So I copy/paste the rest of the string, and it goes bad. My variables are not showing, or something. (as you can tell, I am not coder extrodinaire).

I will simplify, taking out the ANSI formatting and just use the first variable.

What I need is:

( 0)

My previous problem gave me:

(0)

With this string:

[space(9)](%format(@DGH))

Vijilante suggested:

[space(9)](%format("&2s",@DGH))

Which -seemed- to work one time, but not since. I get:

()

So to troubleshoot, I started changing the variable. With a variable of:
0
I get
()
With a variable of:
*space*0
I get
( 0)
Which is what I want. But a variable of:
12
I get
()
and a variable of:
*space*12
I get
( 12)
When I would like to get
(12)

The *space* denotes a space. :)

Hope that is a little more clear. Thanks.
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Mon Dec 17, 2001 5:14 am   
 
So the variables will always be numeric?

If so, try this:

#show %concat(" (", %format("&2.0n", @DGH), ") (**)");#show %concat(" /", %format("&2.0n", @DGLT), "|", %format("&2.0n", @DGCT), "|", %format("&2.0n", @DGRT), " /", %format("&2.0n", @DGLTR), "|", %format("&2.0n", @DGCTR), "|", %format("&2.0n", @DGRTR), " (", %format("&2.0n", @DGLA), "/ || ", %format("&2.0n", @DGRA), ")");#show %concat(" / / (", %format("&2.0n",@DGLL), "/ ", %format("&2.0n", @DGRL), ")")

I still don't know where the [space(9)], %cg, %cn, %ch, and %r come from, so I left them out.

Iljhar
Reply with quote
ravin
Newbie


Joined: 13 Nov 2000
Posts: 6

PostPosted: Mon Dec 17, 2001 5:17 am   
 
quote:

So the variables will always be numeric?

Iljhar



Yes
Reply with quote
ravin
Newbie


Joined: 13 Nov 2000
Posts: 6

PostPosted: Mon Dec 17, 2001 5:40 am   
 
quote:

So the variables will always be numeric?

If so, try this:

#show %concat(" (", %format("&2.0n", @DGH), ") (**)");#show %concat(" /", %format("&2.0n", @DGLT), "|", %format("&2.0n", @DGCT), "|", %format("&2.0n", @DGRT), " /", %format("&2.0n", @DGLTR), "|", %format("&2.0n", @DGCTR), "|", %format("&2.0n", @DGRTR), " (", %format("&2.0n", @DGLA), "/ || ", %format("&2.0n", @DGRA), ")");#show %concat(" / / (", %format("&2.0n",@DGLL), "/ ", %format("&2.0n", @DGRL), ")")

I still don't know where the [space(9)], %cg, %cn, %ch, and %r come from, so I left them out.

Iljhar



I still don't know where the [space(9)] -MUXside formatting for 9 spaces-, %cg -MUXside ANSI formatting for color green-, %cn -MUX color normal-, %ch -MUX color hilight- , and %r -MUX carriage return- come from, so I left them out.
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Mon Dec 17, 2001 6:04 am   
 
What exactly is your trigger to show all this? Or is this an alias that you call? Also, what do you use to output this to the screen? You can't just say "%format("&2n", 12)" because it will send that to the mux. You have to use #show or #say or something like that. Can you post your whole trigger/alias/whatever it is your calling this from?

Iljhar
Reply with quote
ravin
Newbie


Joined: 13 Nov 2000
Posts: 6

PostPosted: Mon Dec 17, 2001 6:41 am   
 
quote:

The %concat seemed to do the trick. I have it working(with no colors atm). Here is the string.

~@emit [space(9)] %concat( " (", %format( "&2.0n", @DGH), ") [space(9)] (**)")%r[space(7)]/%format( "&2.0n", @DGLT)|%format( "&2.0n", @DGCT)|%format( "&2.0n", @DGRT)[space(5)]/%format( "&2.0n", @DGLTR)|%format( "&2.0n", @DGCTR)|%format( "&2.0n", @DGRTR)\%r[space(5)] %concat( " (", %format( "&2.0n", @DGLA)/[space(1)]||[space(1)]\%format( "&2.0n", @DGRA)))%r [space(7)]/[space(2)]/[space(2)]\%r[space(7)](%format( "&2.0n", @DGLL)/[space(2)]\%format( "&2.0n", @DGRL))

Which gives me:

     ( 0)             (**) 
 / 0| 0| 0     / 0| 0| 0 
( 0/ ||  0) 
   /  /   
( 0/     0) 

The trigger:
You hit for 2 points of damage in the Head

Would yield:
     ( 2)             (**) 
 / 0| 0| 0     / 0| 0| 0 
( 0/ ||  0) 
   /  /   
( 0/     0) 

And the trigger:
You hit for 22 points of damage in the Head

     (22)             (**) 
 / 0| 0| 0     / 0| 0| 0 
( 0/ ||  0) 
   /  /   
( 0/     0) 

So, I think Ive got it now. Thanks for the help, guys. Had to learn to format my posts before I could learn to format my aliases :)


Reply with quote
BadMojo
Wanderer


Joined: 11 Oct 2000
Posts: 84
Location: USA

PostPosted: Mon Dec 17, 2001 11:30 pm   
 
Heh.. This code looks strangely familiar.. and you didn't even cite me as the author (cry) Why did you not just ask me online?

Looks like you just have a failed import of my settings, no need to re-invent the wheel, just page me online. (face)




-BadMojo
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net