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
Chigins
Newbie


Joined: 27 Feb 2002
Posts: 7

PostPosted: Wed Feb 27, 2002 3:20 pm   

Another Variable Question
 
Atleast I think this is a variable Question?
I am very new to Zmud. I hope I have given enough information.

In my MUD
"Di Carnival" gives me the following information.

>di carnival

Report for Carnival - Duchy of Carnival
Development level: Bureaucracy
Population level: 5,100
Turnover tax base rate: 0%
Overlord: Rere

Droidhomeworld Industrial
Escapade Leisure
Oodles Mining & Extraction
Quazar Leisure
Zsiveria Leisure
Tenchuu Technological

This information Changes occasionally. I would like to extract the names from the first colum into a list that would allow me to do the following

"Di <firstnameincolumn>"

I would like to do this for each name in the list.

PLease help
Chigins
Reply with quote
Chigins
Newbie


Joined: 27 Feb 2002
Posts: 7

PostPosted: Wed Feb 27, 2002 3:38 pm   
 
The Informatino comes more like 2 Columns on the MUD screen.

Example:

Droindhomeworld <<space>> Leisure
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Feb 27, 2002 4:18 pm   
 
Here is your info surrounded by the [ c o d e ] [ / c o d e ] (shows the spacing)
>di carnival


Report for Carnival - Duchy of Carnival
Development level: Bureaucracy
Population level: 5,100
Turnover tax base rate: 0%
Overlord: Rere

Droidhomeworld Industrial
Escapade Leisure
Oodles Mining & Extraction
Quazar Leisure
Zsiveria Leisure
Tenchuu Technological


Something probably best handled by the zMud database.

TonDiening
Beta Upgrading to 6.26
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Feb 28, 2002 12:52 am   
 
#TR {Report for %w} {#VAR diblank 1;#T+ diblank}
#TR {$} {#IF (@diblank > 0) {#T+ di;#VAR diblank 0} {#T- di;#T- diblank}} diblank
#TR {^(%w)} {#ADDITEM dilist %1} di


This will create/add to a list. Using #ADDITEM will prevent duplication of items. If you prefer to allow duplicates, you'll need to use the %additem() function. I've assumed you'll have exactly one blank line just before the list of names and at least one blank line following them. Using this list to generate additional reports which will in turn supply additional names to the list is likely to be tricky. A loop structure probably won't work, since the number of loops needed will change during the loop. This might work:

#VAR direport 1
#AL direport {#IF (@direport <= %numitems(@dilist)) {di %item(@dilist,@direport);#ADD direport 1} {#SAY All done}}


You'd need to re-enter the "direport" command manually with this script. If you want to automate that, add the command "direport" to the false portion of the "$" trigger.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
Chigins
Newbie


Joined: 27 Feb 2002
Posts: 7

PostPosted: Thu Feb 28, 2002 1:33 am   
 
Thank you I will try that. The manipulation of the values retrieved will never return the list. The fist command "di Carnival" is constant and returns this list because of the Development Level Bureaucracy
Reply with quote
Chigins
Newbie


Joined: 27 Feb 2002
Posts: 7

PostPosted: Thu Feb 28, 2002 3:08 am   
 
Thank you very much for the help. The script you gave me gets the list I want but it also gets the first word or every other line on the screen.

Please advise
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Feb 28, 2002 6:54 pm   
 
The script is doing exactly what it's supposed to, capturing the first word of each line. You have to disable the di class when you finish the list to stop it.

Apparently, it DOESN'T end with a blank line, which (as I stated) I had assumed in writing the script. Since I have no idea what would indicate the end of the list, you'll have to find some way of writing a trigger that detects when you've reached the end of the list and use that trigger to issue the #T- di and #T- diblank commands.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
Chigins
Newbie


Joined: 27 Feb 2002
Posts: 7

PostPosted: Fri Mar 01, 2002 4:16 am   
 
Thank you again. I will work on getting that end sign trigger. It does have one blank line after the last planet name though.

Chigins
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Mar 01, 2002 5:50 pm   
 
If it does have a blank line after the last planet it should work. The first trigger sets @diblank to 1 and turns the diblank class on. When the first blank line comes (just before the planet list) @diblank = 1, so the second trigger sets @diblank to 0 and turns the di class on. When the second blank line comes (after the planet list) @diblank = 0, so the second trigger should turn off the di class and the diblank class.

The second blank line might not actually be blank, it might contain spaces.

The most likely problem is that you are generating reports on those planets, which in turn is setting off the triggers. This can be fixed by changing the trigger phrase on the first trigger to be more specific.
#TR {Report for Carnival} {#VAR diblank 1;#T+ diblank}

LightBulb
All scripts untested unless otherwise noted
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Mar 01, 2002 6:35 pm   
 
I cheated there. There is a null line inbetween Overlord and Droidhomeworld.

If I didn't add that line it would "eat" it. I should have mentionned that in
my post.

Result of the line with no spaces:


Report for Carnival - Duchy of Carnival
Development level: Bureaucracy
Population level: 5,100
Turnover tax base rate: 0%
Overlord: Rere

Droidhomeworld Industrial
Escapade Leisure
Oodles Mining & Extraction
Quazar Leisure
Zsiveria Leisure
Tenchuu Technological



TonDiening
Beta Upgrading to 6.26
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Mar 02, 2002 3:35 am   
 
Ton, as you can see from my use of {$} as the trigger phrase, a null line is what I expected.

LightBulb
All scripts untested unless otherwise noted
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