Skip to content

Commit 123f4d8

Browse files
committed
Updates to eget, foreach, mapnav, menuid, recolor, spellmerge, qverb and xmlpatch
1 parent 2af3ca0 commit 123f4d8

File tree

10 files changed

+2581
-723
lines changed

10 files changed

+2581
-723
lines changed

Foreach.md

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Foreach 0.9.9
1+
# Foreach 0.10
22

33
*Stop the up-up-up-enter!*
44

@@ -44,9 +44,9 @@ While not a full replacement for "proper" purpose-built Lich scripts, it is stil
4444

4545
## That's nice. But what can it REALLY do?
4646

47-
Usage: **;foreach** _[options]_ _[what]_ **in/on** _target_ [**;** _command1_**;** _command2_**;** ...]
48-
*or:* **;foreach** _[options]_ _[what]_ **in/on** _target_ [**/** _command1_**/** _command2_**/** ...]
49-
*or:* **;foreach** _[options]_ _[what]_ **in/on** _target_ [**|** _command1_**|** _command2_**|** ...]
47+
Usage: **;foreach** _[options]_ _[what]_ **in/on/under/behind** _targets_ [**;** _command1_**;** _command2_**;** ...]
48+
*or:* **;foreach** _[options]_ _[what]_ **in/on/under/behind** _targets_ [**/** _command1_**/** _command2_**/** ...]
49+
*or:* **;foreach** _[options]_ _[what]_ **in/on/under/behind** _targets_ [**|** _command1_**|** _command2_**|** ...]
5050

5151
### Options
5252

@@ -66,8 +66,16 @@ of the following:
6666
* **first _N_**
6767
Stop after _N_ matching items have been encountered. (The word `first` is optional)
6868
* **skip _N_** _or_ **after _N_**
69-
Skip the first _N_ matching items.
70-
69+
Skip the first _N_ matching items.
70+
* **sort** or **sorted**
71+
Sort items by name within each respective container. Articles "a", "an", "some" and "the" are ignored when sorting.
72+
Containers will still be handled one at a time, and the order of the containers themselves is not affected.
73+
* **reverse** or **reversed**
74+
Reverse the order of items within each container. If used alone, this means the last item in each container in
75+
processed first and vice versa. If used with **sorted**, items will be handled in descending alphabetical order
76+
rather than ascending.
77+
Containers will still be handled one at a time, and the order of the containers themselves is not affected.
78+
7179
Options are applied roughly in the order listed above. You can combine **first** with **skip**:
7280
`;foreach first 5 after 10` will match items 11 through 15.
7381

@@ -80,6 +88,8 @@ _what_ allows you to filter the types of items `foreach` acts on. It can be one
8088
(which includes things like palimpests and other 'alternate names' for scrolls). `;foreach` by itself will show all
8189
the known types. `;foreach in inv` with no commands will show the types of all items it finds.
8290

91+
You can use `type=none` to explicitly find items that have no defined type according to Lich.
92+
8393
**Note:** This is only as accurate as Lich's own type data. You may be able to get more accurate type data by downloading and running the `gameobjadd` script at startup.
8494

8595
* **noun=**_pattern_ or **n=**_pattern_
@@ -103,10 +113,11 @@ _pattern_ can be:
103113
* `this,that`: Match any one of the options separated by commas.
104114
* `blue sapphire,emerald,*diamond,*emerald,uncut ruby`: You can mix the above.
105115

106-
### Target
116+
### Targets
117+
118+
_targets_ tells ;foreach where you want to look for the items. You can specify one or more _target_, separated by commas.
107119

108-
_target_ tells ;foreach where you want to find the items. You can specify any container exactly like you'd specify it to
109-
a command in game, but there's also a few special options:
120+
Each target can be the name of an actual container in game ("cloak", "my backpack", etc.), or one of the following options:
110121

111122
* **inv** or **inventory**
112123
Examines the contents all containers in your inventory.
@@ -124,11 +135,14 @@ a command in game, but there's also a few special options:
124135
Examines items in your inventory, *not* their contents. Want to register everything you are wearing?
125136
`foreach in worn; remove item;register item;wear item`
126137

127-
* **last**
138+
* **last** or **previous**
128139
Last is a set of items that matches whatever the last run of foreach found. You can use this to quickly undo if you
129140
manage to flub something up, like accidentally moving all of your inventory to your locker rather than just your boxes.
130141

131-
If you specified a _what_ (above section), it will further restrict the list of what foreach is working on
142+
When using **last**, the container items are reported in will be the container they started the previous run in -- not
143+
their current location.
144+
145+
If you specified a _what_ (above section), it will further restrict the list of what foreach is working on.
132146

133147
### Commands
134148

@@ -327,18 +341,20 @@ Depending on the level of depth you want, either just read the bold parts, just
327341
If, after all of the above, ;foreach doesn't have status data for the container (meaning it's probably not in your inventory),
328342
it assumes that it won't have status data for any of its contents either and exits.
329343

330-
4. **Item Filtering**: For each container and list of items in to_filter, items are filtered based on your criteria,
344+
4. **Item Sorting**: If the SORTED or REVERSED options are specified, they are applied to each container inventory.
345+
346+
5. **Item Filtering**: For each container and list of items in to_filter, items are filtered based on your criteria,
331347
including applying any options (e.g. `UNIQUE`, `MARKED`, `FIRST 5`). If you're filtering by status and any item is
332348
not found in the the table, `;foreach` complains loudly and exits. This particular failure should never occur,
333349
since of all the related checks should have happened earlier.
334350

335351
Any containers that have items left after the filtering phase are removed from the relevant tables.
336352
If no remaining items exist, ;foreach exits.
337353

338-
5. **Snapshot**: At this point, ;foreach knows every single item and container it is going to work on. This information
354+
6. **Snapshot**: At this point, ;foreach knows every single item and container it is going to work on. This information
339355
is saved for later usage in `;foreach in last`, and then the execution phase begins
340356

341-
6. **Execution**: For each container:
357+
7. **Execution**: For each container:
342358
* If there are no commands, pretty-print a list of matching contents in that container.
343359
* Otherwise, for each item in the container, for each command:
344360
* Replace "item", "noun", "name" and "container" with the item ID, item noun, item name and container ID.
@@ -357,9 +373,25 @@ Depending on the level of depth you want, either just read the bold parts, just
357373
would scroll by while in roundtime, or the script waiting to pause (and thus preventing it from being unpaused
358374
until you are out of roundtime)
359375

360-
361376
## Changelog
362377

378+
### Version 0.10 (2019-06-10)
379+
* Foreach now reports its status in the shortcut bar in Stormfront, and can be paused, resumed, or killed from that location.
380+
* You can now look under/behind containers instead of just in/on them.
381+
* Legacy premium locker searching now looks ON armor stands and weapon racks rather than IN them.
382+
(This code only triggers if LOCKER MANIFEST fails for whatever reason).
383+
* Pattern matching is no longer case-sensitive
384+
`;foreach q=elan*pack in pack` should now match "an Elanthian Guilds voucher pack"
385+
* You can now `;foreach sorted ...` to iterate over items sorted by their full name within their containers.
386+
* Articles a/an/some/the are ignored when sorting, so "some ambrominas leaf" sorts before than "a clear zircon"
387+
* This does not affect the order containers are traversed.
388+
* You can now `;foreach reversed ...` to iterate over items backwards within their containers.
389+
* When combined with `sorted`, this does items in descending order.
390+
* This does not affect the order containers are traversed.
391+
* You can now specify multiple targets in a single `;foreach command`
392+
Example: `;foreach gem in backpack,cloak,Wyrom disk,locker ...`
393+
* `;foreach type=none ...` will now match items that have no explicit type defined.
394+
363395
### version 0.9.9 (2019-05-24)
364396
* Add `UNMARK` shortcut for `MARK <item> REMOVE`
365397
* Improved documentation, including updating the online documentation

0 commit comments

Comments
 (0)