@verb #51:"m*ove c*opy mv cp" any any any rdo #55 @program #51:"m*ove c*opy mv cp" any any any "return player:tell(\"Sorry, move is temporarily off-line. If you need move for the programmer's test mail a wizard and you will be pardoned.\");" verb = (is_move = verb[1] == "m") ? "move" | "copy" if (!(who = this:loaded(player))) player:tell(this:msg_nothing_loaded()) return endif wargs = args t = to_pos = 0 while (t = "to" in (wargs = wargs[t + 1..length(wargs)])) to_pos = to_pos + t endwhile range_args = args[1..to_pos - 1] if (!to_pos || $ERR == typeof(dest = this:parse_insert(who, $string_utils:from_list(wargs, " ")))) player:tell(verb, " to where? ") elseif (dest < 1 || dest > (last = length(this.texts[who])) + 1) player:tell("Destination (", dest, ") out of range.") elseif ("from" in range_args || "to" in range_args) player:tell("Don't use that kind of range specification with this command.") elseif (typeof(range = this:parse_range(who, {"_", "^"}, @args[1..to_pos - 1])) != $LIST) player:tell(range) elseif (range[3]) player:tell("Junk before `to': ", range[3]) elseif (is_move && dest >= range[1] && dest <= range[2] + 1) player:tell("Destination lies inside range of lines to be moved.") else from = range[1] to = range[2] ins = this.inserting[who] text = this.texts[who] if (!is_move) if (value_bytes(this.texts) > 1048576) return player:tell("Sorry. Editing a too-big file. You lose.") endif this.texts[who] = {@text[1..dest - 1], @text[from..to], @text[dest..last]} if (ins >= dest) this.inserting[who] = ins + to - from + 1 endif else "Oh oh... it's a move" if (dest < from) newtext = {@text[1..dest - 1], @text[from..to], @text[dest..from - 1], @text[to + 1..last]} if (ins >= dest && ins <= to) ins = ins > from ? ins - from + dest | ins + to - from + 1 endif else newtext = {@text[1..from - 1], @text[to + 1..dest - 1], @text[from..to], @text[dest..last]} if (ins > from && ins < dest) ins = ins <= to ? ins + dest - to - 1 | ins - to + from - 1 endif endif this.texts[who] = newtext this.inserting[who] = ins endif this.changes[who] = text this.times[who] = time() player:tell("Lines ", is_move ? "moved." | "copied.") endif "Last modified by Dax (#789) on Mon Dec 10 21:12:50 2001 MST." "This verb previously owned by whiz (#3135), and chowned to $slacker upon dewizarding (Sat Aug 17 14:50:03 2002 MDT)." "Last modified by Dax (#789) on Wed May 4 06:46:00 2005 MDT." .