@verb #2:"do_www_setup" this none this rxdo #789
@program #2:"do_www_setup" this none this
"Processes the POST arguments from a setup request."
"This verb handles basic setup (name/location/parent/desc)."
"Override to add more functionality. Don't forget to pass."
caller == this && player:isa($webber) || raise(E_PERM)
if ($www:parse_POST("kick"))
player:tell("Kicking object.
")
this:kick()
endif
if (!$www:parse_POST("objectsetup"))
return
endif
set_task_perms(player.user.wizard ? this.owner | player.user)
if ((x = $www:parse_POST("name")) != E_PROPNF)
if (x != this.name)
player:tell("Renaming object.
")
result = `this:_set_name(x) ! ANY'
if (result == E_PERM)
$msg:mtell("www_error", "Permission denied! You cannot rename this object.")
elseif (result == E_INVARG)
$msg:mtell("www_error", "That name is either conflicts with an existing name, or it is prohibited for some reason.")
elseif (result == E_NACC)
$msg:mtell("www_error", "Sorry, a name database is currently frozen. Try again in a moment.")
elseif (result == E_ARGS)
$msg:mtell("www_error", "That name is waaay too long!")
elseif (typeof(result) == $ERR)
$msg:mtell("www_error", tostr("Unknown error: ", result))
endif
endif
endif
if ((x = $www:parse_POST("location")) != E_PROPNF && x != $su:nn(this.location))
newloc = $su:match_nn_object(x, this.location, player.user)
valid(newloc) || (newloc = $room_db:find(x))
if (newloc == this.location)
"Don't touch it."
elseif (valid(newloc))
player:tell("Moving object to ", $su:nn(newloc), ".
")
x = `this:moveto(newloc) ! ANY'
suspend(0)
if (this.location != newloc)
$msg:mtell("www_error", tostr("Unable to move ", this.name, " to ", newloc.name, " (", x, ")."))
endif
else
$msg:mtell("www_error", "Couldn't match new location (" + x + ").")
endif
endif
if ((x = $www:parse_POST("parent")) != E_PROPNF && x != $su:nn(parent(this)))
newpar = $su:match_nn_object(x, this.location, player.user)
if (newpar == parent(this))
"Don't touch it."
elseif (valid(newpar))
player:tell("Chparenting object to ", $su:nn(newpar), ".
")
x = `$building_utils:chparent(this, newpar) ! ANY'
suspend(0)
if (typeof(x) == $ERR)
$msg:mtell("www_error", tostr("Error during chparent (", x, ")."))
if (x == E_INVARG)
player:sub_tell(" Some property (or -o verb) on %2 is defined on %1 or one of %1~p descendants. ", this, newpar)
endif
endif
else
$msg:mtell("www_error", "Couldn't match new parent (" + x + ").")
endif
endif
if ((x = $www:parse_POST("desc")) != E_PROPNF && !equal(x, this:_get_description()))
player:tell("Setting the new description.
")
this:_set_description(x)
endif
"Last modified by Dax (#789) on Tue May 3 13:45:55 2005 MDT."
.