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
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 6:31 am   

Status Window
 
Is it possible within version 6.16 to have my status window split into 2 columns?

I want one window to show on the right column my tracking numbers (potions/scrolls/etc)
and on the left i want to add other stuff.

I know how to make one, but its like a piece of paper, i dont know how to make it, if possible into columns, unless i manually space it out per line (a hassle.)

Thank you,


Edwub the Mage
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Jan 04, 2003 7:29 am   
 
Have a look/see of Charbal's Status Window Extender

quote:

..
Example usage:
addtext HP 1 1 HP: @HP
addtext MV 1 10 MV: @MV
addtext Opponent 2 1 Current opponent: @Opponent

This will start the HP display at column 1 and the MV display at column 10 of the first row and display your current opponent on line 2 (assuming that you are storing these things in @HP, @MV and @Opponent). Once these elements have been added, any changes in the variables will be reflected in the status window
..



Ton Diening
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 7:46 am   
 
Thanks!!!
It will take me a few tries to learn and experiment to get it right, but this can work perfect!



Edwub the Mage
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 8:48 am   
 
How many columns are in a standard status window?

Edwub the Mage
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Jan 04, 2003 8:59 am   
 
It is one column and one line unless you format your data.

quote:

STW example

#STW { Hp: @hp %cr Exp: @exp %cr %ansi(red)Tank: @tank}

Defines a three line status window. The first line shows that current hitpoints in the @hp variable, the next line shows the experience in the @exp variable, and the last line shows the name of the current tank in red.



There Zugg formats his data using %cr

Ton Diening
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 9:21 am   
 
Using Charbal's status window extender, it works like a charm...


except for one thing I can't figure out.
Zmud seems to think row 24 is at the bottom of the status window.
It refuses to let me add anything to the black line between 23 and 25, and i tried adding different things, removing/readding, etc

Edwub the Mage
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 10:08 am   
 
ok, i fixed the aforementioned unproblem..not sure what caused it.
I just removed everything and readded


now heres my new question =)


I have an alias 'wandstatus' that shows me:
Checking Wand and Potion Status Now, Sir!


WANDS
-----------------------------------
Celtic Wand: 7 charges.
My Rotonda: 9 charges.
Golden Wand: 10 charges.


SCROLLS
-----------------------------------
Scrolls of Recall: 47 remaining.
Life-Insurance Scrolls: 1 remaining.


POTIONS
-----------------------------------
Vampire Essences Left: 43
Red Potions Left: 48
Soul Potions Left: 88
Purple Potions Left: 0
Sand Left: 7
Yellow Potions Left: 22


Now i have that all in my status window, but it refuses to change/refresh.

Status window claims 0 for all the potions and scrolls.
I copypasted the alias onto word, so i know all the var names are the exact same ones (besides, no way i would mess up *every* single var name).

Made an alias 'statreset' to #stw off; #stw on thinking it would reset, but it doesnt.

Any advice?


Edwub the Mage
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 10:27 am   
 
Ok, in reply to myself, when i had entered those addtexts, the variables were set at 0. after i entered it all i counted.

In testing though, the window doesn't refresh.
I had one of my wands at 7 charges, i filled it til it was 10.

My alias showed 10, my status window still shows 7, even after i #stw off; #stw on

How do i make it refresh itself/keep accurate?


Edwub the Mage


edit: I made an alias to manually remove everything in the status bar, then manually add it.
It *does* refresh all the numbers/stats but there has to be a smarter/better way to do it automatically.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jan 04, 2003 3:31 pm   
 
It sounds like your variables are being evaluated when you addtext. Check the status window definition in the Settings Editor.

If your status window definition has
Celtic Wands: @celtic charges
it should update itself when @celtic changes.

If your status window definition has
Celtic Wand: 7 charges
it won't.

LightBulb
Senior Member
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 8:13 pm   
 
I add the text with the variables though, I guess it automatically puts the numbers in the definition.

But i need to use Charbal's addtext method to organize the status window.

If i edit the definition itself, it loses the rows and columns and comes out looking like a big paragraph.



Edwub the Mage

edit:



addtext 4 6 58 Celtic Wand: @celticcharge charges.
(similar for the other 2).

The results:

New status text (ID 4) added at row 6, column 58: "Celtic Wand: @celticcharge charges."
New status text (ID 5) added at row 7, column 58: "My Rotonda: @rotondacount charges."
New status text (ID 6) added at row 8, column 58: "Golden Wand: @goldencount charges."
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jan 04, 2003 8:24 pm   
 
To prevent what LightBulb mentioned from happening make sure that Expand Vars in the Script Parser section of the Preferences is not selected.

Kjata
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 8:33 pm   
 
'Expand Vars' hasn't been clicked on, its been off the whole time =(

Edwub the Mage
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jan 04, 2003 9:17 pm   
 
I get no such problem. I just copy and pasted Charbal's Status Extender to zMUD and then used your sample line:
addtext 4 6 58 Celtic Wand: @celticcharge charges.

Since @celticcharge did not exist it displayed Celtic Wand: charges. in the status window. Once I did this:
#VAR celticcharge 10

It updated automatically to:
Celtic Wand: 10 charges.

Afterwards, doing:
#VAR celticcharge 11

once again updated the window to:
Celtic Wand: 11 charges.

You can try open a blank window by hitting ESC in the Character Selection screen and testing to see if you get the same problem with no other settings. Otherwise, I don't know what else to suggest.

Kjata
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jan 04, 2003 9:18 pm   
 
I get no such problem. I just copy and pasted Charbal's Status Extender to zMUD and then used your sample line:
addtext 4 6 58 Celtic Wand: @celticcharge charges.

Since @celticcharge did not exist it displayed Celtic Wand: charges. in the status window. Once I did this:
#VAR celticcharge 10

It updated automatically to:
Celtic Wand: 10 charges.

Afterwards, doing:
#VAR celticcharge 11

once again updated the window to:
Celtic Wand: 11 charges.

You can try open a blank window by hitting ESC in the Character Selection screen and testing to see if you get the same problem with no other settings. Otherwise, I don't know what else to suggest.

Kjata
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Sat Jan 04, 2003 10:02 pm   
 
There are apparently bugs in zMUD 6.16's implementation of %expand on database records that keep this script from working.

Everything works fine up until the recalculate alias. When 6.16 encounters the %expand(%i.Content, 1), it seems to expand it all the way instead of just one level. The same thing happens if %db is used instead of the dot notation.

I also experimented with using a #FUNCTION returning the value to put in the window instead of an alias (that way, the status window could reference the function and it should automatically update it in theory). However, it seems that calling the recalculate alias from within %exec causes zMUD 6.16 to crash silently for some reason.

If the Expand Vars option was on, you wouldn't be able to import the script from the command-line (I tried) and you wouldn't get
New status text (ID 4) added at row 6, column 58: "Celtic Wand: @celticcharge charges."
but instead
New status text (ID 4) added at row 6, column 58: "Celtic Wand: 7 charges."

as it would have already been expanded by that point.


So, due to bugs in zMUD 6.16's handling of expansion of database records, this script doesn't work as written.

If you don't want to upgrade (even though I highly recommend 6.40), this should have the effect of updating the status window every second with the current values:

#ALARM *1 {recalculate}


 - Charbal
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sat Jan 04, 2003 10:04 pm   
 
Then i think I'll have to update soon.
But thanks Charbal, i was going nuts trying to figure out why it didnt refresh.

I'll put the alarm value in every 10 seconds or so and see how that works out.

Until I update I guess.

Kjata, Tom, LightBulb, and especially Charbal---
thanks a LOT for all your help, you guys are life savers =)



Edwub the Mage
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Sun Jan 05, 2003 4:48 am   
 
Then i think I'll have to update soon.
But thanks Charbal, i was going nuts trying to figure out why it didnt refresh.

I'll put the alarm value in every 10 seconds or so and see how that works out.

Until I update I guess.

Kjata, Tom, LightBulb, and especially Charbal---
thanks a LOT for all your help, you guys are life savers =)


Edwub the Mage



edit: On the side, I now learned just how useful alarm can be.
Going to be very helpful for pk >:)
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Tue Jan 07, 2003 11:19 am   
 
Ok, this is more of a new subject, but just using this aptly titled thread. (and the information above may help others).


I now have a kickass status window, and beautifully organized thanks to Charbal.
I like it so much, and it all works so great i want to add more to it.

Now, i have it tabbed at the top, so my normal mud says Charname, and thetab to the right is the status window.

My question is if i can have more then one status window at the same time, and if they are nameable beyond "Status Window".

I would love to have one be "General" and the 2nd be "Misc"



Edwub the Mage


edit: ZMUD Version 6.16
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jan 07, 2003 2:50 pm   
 
You can't have more than one status window, but you can have more than one normal window. Since the same control codes work with the statsu window as well as normal windows, I've modified Charbal's script to work with normal windows (so I guess this is Kjata's Charbal's Status Window Extender Extender ):

#CLASS {WindowExtender}
#VAR TempOutput %null
#VAR Windows %null
#VAR RefreshAmount 1
#VAR Found 0
#ALIAS recalculate {#LOOPDB @Windows {#VARIABLE TempOutput %null;#FORALL %val {#VARIABLE TempOutput %concat( %expand( @TempOutput, 1), %char( 27), "[", %db(%i, "Row"), "~;", %db(%i, "Column"), "f", %expand( %db(%i, "Content"), 1))};:%key:#CLR;#EXECUTE %concat( "#WIN ", %key, " ", %char( 34), %expand( @TempOutput, 2), %char( 34))}}
#ALIAS setrefreshamount {#IF ((%lower( %1) = "off") or (%1 = 0)) {#T- autorecalculate;#SAY Windows will not be refreshed.} {#IF (%lower( %1) = "on") {#T+ autorecalculate;#SAY Windows will be refreshed every @RefreshAmount seconds.} {#IF (%isnumber( "%1")) {#VARIABLE RefreshAmount %1;#T+ autorecalculate;#SAY Windows will be refreshed every %1 seconds.} {#SAY Invalid argument to setrefreshamount.}}}}
#ALIAS addtext {#IF (!%iskey( @Windows, "%1")) {#ADDKEY Windows %1 %null};#VARIABLE Found 0;#FORALL @Windows.%1 {#IF (%db(%i, "ID") = "%2") {#VARIABLE Found 1}};#IF (@Found = 0 and %isnumber( %3) and %isnumber( %4) and %3 > 0 and %4 > 0) {#ADDITEM Windows.%1 %addkey( %addkey( %addkey( %addkey( %null, "ID", "%2"), "Row", %3), "Column", %4), "Content", %literal( "%-5"));#SAY New status text ~(ID %2) added at row %3, column %4, to window %1: %literal( "%-5");recalculate} {#SAY Unable to add status text ~(could be due to a duplicate ID or an invalid row and column specification)}}
#ALIAS remtext {#VARIABLE Found %null;#LOOP 1,%numitems( @Windows.%1) {#IF (%db( %item( @Windows.%1, %i), "ID") = "%2") {#VARIABLE Found %if( @Found = %null, %i, %concat( %i, "|", @Found))}};#IF (@Found <> %null) {#FORALL @Found {#DELNITEM Windows.%1 %i};#SAY Status text ID %2 removed from display list in window %1.;recalculate} {#SAY Unable to find ID %2 in window %1.;listtexts}}
#ALIAS listtexts {#SAY Currently defined positional window texts are:;#LOOPDB @Windows {#SAY %ansi( bold, blue)Window %key:;#FORALL %val {#SHOWDB %i}}}
#ALARM "autorecalculate" *@RefreshAmount {recalculate} "" {disable}
#CLASS 0

The commands are the same, except there is an extra argument when adding and removing text - the window name - so I'll just copy the syntax from Charbal's post and modify it where necessary:
addtext window ID row column text to put in status window
Window is the name of the window where the text is to be added
ID is a unique specifier for the element to add to the window
Row and column start at 1

remtext window ID
Removes the text with the unique identifier ID in the specified window

listtexts
Displays the IDs, positions and content of all currently defined positional window elements.

setrefreshamount amount
Sets the time the script waits between refreshed of the windows. Amount is in seconds and it can have the special value of 0 or "off" to disable refreshing or "on" to enable refreshing. If refreshing is disabled and a numeric value is passed, refreshing is enabled automatically.

recalculate
Regenerates the status window definition from the list of text positions. This alias is executed internally by the script as needed and shouldn't be necessary unless the status window is overwritten with some other value.

Example usage:
addtext test1 HP 1 1 HP: @HP
addtext test2 MV 1 10 MV: @MV
addtext test2 Opponent 2 1 Current opponent: @Opponent

The drawback of not using the Status Window is that the text is not automatically refreshed when the value of a variable changes. For this reason, there is an alarm that constantly refreshes the windows. Its period can be set with setrefreshamount.

05/06/2003 - Edited to add support for version 6.61.

Kjata
Reply with quote
Turnip
Beginner


Joined: 22 Jan 2003
Posts: 11
Location: United Kingdom

PostPosted: Tue May 06, 2003 9:09 am   
 
Hi Kjata

I seem to be having a problem with this script in v6.61. My lovely status windows all seem to be broken.

I added this:

addtext who who 1 1 @who

and this was inserted in the window:

fIDwhoRow1Column1Content


Have I done something wrong, or if not, could you have a look at the script and perhaps, If you're not too busy, rewrite it so that it works in 6.61?

Many thanks

Turnip
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue May 06, 2003 1:53 pm   
 
I changed the script above to fix the problem.

Kjata
Reply with quote
Turnip
Beginner


Joined: 22 Jan 2003
Posts: 11
Location: United Kingdom

PostPosted: Tue May 06, 2003 11:21 pm   
 
Thanks Kjata

Turnip
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