|
Xerakon Apprentice
Joined: 10 May 2011 Posts: 111
|
Posted: Sun Mar 13, 2016 1:16 am
Compiling a Variable List? |
Hey guys,
I'm not sure how to describe what I want to do...
So, below is a standard display of ships that we might have on a landing pad on our mud.
Code: |
StarHopper 1000 Public Transport '13Hopper'H-Type Nubian Yacht 'Furry Swords'
Barloz-class Medium Freighter 'Brezak'CX-133 Chaos Fighter 'Opaloid'
H-Type Nubian Yacht 'Elliott' Flashfire Starfighter 'Urkupp'
H-Type Nubian Yacht 'Ion Blast' G-Type Light Shuttle 'Oldboy'
YE-4 Gunship 'Corellian Sunset' Flashfire Starfighter 'Furious Flurry'
CX-133 Chaos Fighter 'Verily' Star Saber XC-01 Starfighter 'Halberd'
Flashfire Starfighter 'Naxx' Flashfire Starfighter 'Sixfive'
Star Saber XC-01 Starfighter 'Skyline'Flashfire Starfighter 'Tatek' |
As you can imagine, when you get a room with 50+ of these, it can be ridiculous. So, someone using mush was able to make a display that looks like this one:
Code: |
You see 16 ships here:
[Barloz-class Medium Freighter]: Brezak
[CX-133 Chaos Fighter]: Opaloid, Verily
[Flashfire Starfighter]: Furious Flurry, Naxx, Sixfive, Tatek, Urkupp
[G-Type Light Shuttle]: Oldboy
[H-Type Nubian Yacht]: Elliott, Furry Swords, Ion Blast
[Star Saber XC-01 Starfighter]: Halberd, Skyline
[StarHopper 1000 Public Transport]: 13Hopper
[YE-4 Gunship]: Corellian Sunset |
Any idea how this can be achieved?
Thanks,
X |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Sun Mar 13, 2016 3:07 am |
Fairly easy
First make a list of the types of ships, we will use that to populate the list of individual ships.
#TR {({@shipTypes}) '([^'])'} {
$ships=%db(@shipsHere, %1)
#ADDITEM $ships %2
#ADDKEY shipsHere %1 $ships
#SUB {} //Just to remove captured stuff from the screen
}
You will need to enable the repeat within line option to make sure it captures them all.
From this point you would need to know when to reset and display the value.
Display would be something like...
#FORALL %dbkeys(@shipsHere) {#PRINT {%format("&-25s &s", %concat("[", %i, "]:"), %expandlist(%db(@shipsHere, %i), ", "))}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|
|
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
|
|