rlazarus / MUSS

Multi-User Shared Setting, a modern-day reimplementation of the multiuser text game.
8 stars 1 forks source link

Add a replace command, for string variables. #135

Open relsqui opened 9 years ago

relsqui commented 9 years ago

Because editing descriptions as it is right now is a pain in the ass. Possible syntax off the top of my head: replace here.description "wrong thing" "right thing". Alternative suggestions welcome. Should raise errors if 1) the variable doesn't exist, 2) its value is not a string, or 3) the value doesn't contain the search string.

relsqui commented 9 years ago

Reuven points out: we can also have an HTTP interface for stuff like this. Probably shouldn't be exclusive, but sticking the note here because it's related.

rlazarus commented 9 years ago

Could also be s/foo/bar/ syntax. Downsides are that it's arcane and unfriendly, upsides are that it's flexible, well-defined for complicated cases, and reasonably well-known.

relsqui commented 9 years ago

What's the rest of the line? replace here.description s/foo/bar/? I feel that "replace" and "s/" are redundant. Could have it be part of set instead. Do we require quotes around the whole thing, as set otherwise does for strings? Are you thinking of actually parsing regex?

On balance, my instinct is against this; it's either going to be as complex as people familiar with it expect, which seems out of step with the accessibility goals of this project, or else it's not, which defeats the point of using the familiar syntax.