You are looking at a material handling ideas for wolis

Wolis,
The material changes are excellent. I'll need to rethink a lot of what I've been doing.

Some ideas:
- Rare materials: If we create a material worth a certain amount, then the create command should take that into consideration. Maybe the 'worth' part of create is a base cost, then it sums that plus the worth of each material for the total price to player and worth of final object.

- Swapping substring problems: A problem we might encounter in the future is when using like and swap when a material happens to be the substring of another. A good way to avoid problems is to wrap the string in |'s.

Example:
$mat = ''|living|roaming|dancing|deadly|'';

rem $mat like '|dead|' --> false;
rem $mat like '|deadly|' --> true;

swap $mat so ''|living|'' is ''|dead|'';
swap $mat so ''|roaming| is ''|'';
rem $mat will be '|dead|dancing|deadly|';
rem note: no empty ||'s ;
rem $mat like '|dead|' --> true;
rem $mat like '|deadly|' --> still true;

swap $mat so ''|dead| is ''|living|'';
rem makes sure dead and not deadly are changed;

- Material amounts: A brick of silver is worth more than a pinch of silver dust, but they are the same material. The complexity of dealing with this is a bit scary, so I don't know if it's worth bothering with.

One way to deal with this is to have a second material attribute, perhaps materialamt.

A command that finds the position of a string by delimiiter would help, as well as a swap at position.

Get the position of a substring in a delimited string:

{$position} = positionof {string} in {delimitedstring} by {delimiter};

Note: position 0 = not found

Get the value at the nth position of a delimited string:

{value} = valueat {position} in {delimitedstring} by {delimiter};

Note: value '' = position out of range

Modify the value at the nth position of a delimited string:

swap {$delimitedstring} at {position} by {delimiter} to {newvalue};

Note: if position is higher than the delimiters in the string, COW would need to add null strings to get the newvalue into the right position.
$string = '';
swap $string at 1 by ''|'' to ''hello'';
rem $string becomes 'hello';
swap $string at 5 by ''|'' to ''bye'';
rem $string becomes 'hello||||bye';

Consider a single glass of 12 sips of wine:
$material = ''|glass|wine|'';
$materialamt = ''|1|12|'';

The wine material could deduct 1 from it's amount each time it is a target of drink.

Consider 2 variants of the var command to handle taking 1 sip of the wine from a glass:

$winepos = positionof 'wine' in $material by '|';
rem $winepos = 3 since it is the 3rd string delimited by |;

aside:
rem $beerpos = positionof 'beer' in $material by '|';
rem $beerpos = 0 since there is no beer;

$wineamt = valueat $winepos in $materialamt by '|';
rem $wineamt = 12 because the $winepos (3rd) |-delimited value is 12;

take 1 from $wineamt;
swap $materialamt at $winepos to $wineamt;

rem now $materialamt = '|1|11|';

Alternate way of dealing with materials that doesn't require any COW command changes:

A pocket variable called 'matvals' (material values). Inside it keep one object with same class as each material and info keeps the value.

Then we can find the amount of a material with the find command and look at the info.

These commands would allow other powerful things...

Unrelated example (more powerful parsing):
$command = 'move a shoe from my foot to a purple crate';
$what = valueat 2 in $command by ''move '';
rem now $what = 'a shoe from my foot to a purple crate'
$what = valueat 1 in $what by '' from'';
rem now $what = 'a shoe';