Find
You are looking at an action called crowbar
Created by
Rixel
, last updated 24 Jun 2012
Code
get $target,wth,$second in $loc,$loc or loc = $actor;
if $second > 0 then chkdoor else unlockobj;
##chkdoor:
$tkey = $target's keyid;
if $tkey = $second then unlockdoor else notadoor;
##notadoor:
print "[$actor] discovers that [$target] can not be unlocked with [$second]";
##unlockdoor:
set $target's link = $target's keyloc;
set $target's keyid to '';
set $target's keyloc to '';
set $target's extra to '';
say 'unlocks',"[$actor] manages to unlock [$target] with [$second]";
relook $loc;
# unlock the linked object if there is one..;
$linkedobj = $target's link; remember the linked object;
if $linkedobj > 0 then unlockittoo else end;
##unlockittoo:
set $linkedobj's link = $linkedobj's keyloc;
set $linkedobj's keyid to '';
set $linkedobj's keyloc to '';
set $linkedobj's extra to '';
$loc = $linkedobj's loc; # inform players in this location;
say 'locks',"Someone has unlocked [$linkedobj]";
relook $loc;
##unlockobj:
get $target in $loc;
if $target > 0 then checkloc else lose;
##checkloc:
if $loc's pwd eq $pw then keeponmovin3 else keeponmovin3;
##keeponmovin:
if $target's pwd eq $pw then keeponmovin2 else lose2;
##keeponmovin2:
if $target's class eq 'player' then lose3 else keeponmovin3;
##keeponmovin3:
set $target's pwd to '';
say 'unlocksobj' , "[$actor] unlocks [$target]";
msg $loc,$actor,0,0,'force',"force:look $loc";
if $target's link > 0 then locklink else end;
##locklink:
set $target's link's pwd to '';
##end;
rem look $loc;
##lose:
say 'lockfail', "[$actor] could not unlock $cmd_text";
##lose2:
say 'alreadyapassword', "[$actor] discoveres that [$target] is already unlocked";
##lose3:
say 'cantlockplayer', "[$actor] discoveres that [$target] is a player and cant be unlocked";