@@ -777,7 +777,9 @@ def do_enrich(player: Player, parsed: base.ParseResult, ctx: util.Context) -> No
777777
778778@wizcmd ("add_event" )
779779def do_add_event (player : Player , parsed : base .ParseResult , ctx : util .Context ) -> None :
780- """ Add an event that happens in the current location. """
780+ """ Add an event that happens in the current location.
781+ Usage: add_event <event description>
782+ """
781783 if len (parsed .args ) < 1 :
782784 raise ParseError ("You need to define an event" )
783785 player .location ._notify_action_all ( base .ParseResult (verb = 'location-event' , unparsed = parsed .unparsed , who_info = None ), actor = None )
@@ -798,7 +800,9 @@ def do_spawn(player: Player, parsed: base.ParseResult, ctx: util.Context) -> Non
798800
799801@wizcmd ("load_character" )
800802def do_load_character (player : Player , parsed : base .ParseResult , ctx : util .Context ) -> None :
801- """Load a companion character from file."""
803+ """Load a companion character from file.
804+ Usage: load_character <path to character file>
805+ """
802806 print ('load character ' + str (parsed .args ) + str (parsed .unparsed ))
803807 if len (parsed .args ) != 1 :
804808 raise ParseError ("You need to specify the path to the character file" )
@@ -814,7 +818,9 @@ def do_load_character(player: Player, parsed: base.ParseResult, ctx: util.Contex
814818
815819@wizcmd ("load_character_from_data" )
816820def do_load_character_from_data (player : Player , parsed : base .ParseResult , ctx : util .Context ) -> None :
817- """Load a companion character from file."""
821+ """Load a companion character from file.
822+ Usage: load_character_from_data <json data>
823+ """
818824 try :
819825 unparsed = str (parsed .unparsed )
820826 data = json .loads (unparsed )
@@ -828,7 +834,9 @@ def do_load_character_from_data(player: Player, parsed: base.ParseResult, ctx: u
828834
829835@wizcmd ("set_visibility" )
830836def do_set_visible (player : Player , parsed : base .ParseResult , ctx : util .Context ) -> None :
831- """Set the visibility of a creature."""
837+ """Set the visibility of a creature.
838+ Usage: set_visibility <object> <true|false>
839+ """
832840 if len (parsed .args ) != 2 :
833841 raise ParseError ("You need to specify the object and the visibility(true or false)" )
834842 try :
@@ -866,7 +874,9 @@ def do_set_description(player: Player, parsed: base.ParseResult, ctx: util.Conte
866874
867875@wizcmd ("set_goal" )
868876def do_set_goal (player : Player , parsed : base .ParseResult , ctx : util .Context ) -> None :
869- """Set a goal for a LivingNpc."""
877+ """Set a goal for a LivingNpc.
878+ Usage: set_goal <character> <goal>
879+ """
870880 if not parsed .who_1 :
871881 raise ParseError ("You need to specify a character" )
872882 if len (parsed .args ) < 2 :
@@ -883,7 +893,9 @@ def do_set_goal(player: Player, parsed: base.ParseResult, ctx: util.Context) ->
883893
884894@wizcmd ("create_item" )
885895def do_create_item (player : Player , parsed : base .ParseResult , ctx : util .Context ) -> None :
886- """Create an item in the current location."""
896+ """Create an item in the current location.
897+ Usage: create_item <item_type> [<name>] [<short_description>]
898+ """
887899 if len (parsed .args ) < 1 :
888900 raise ParseError ("You need to define an item type. Name and description are optional" )
889901 item_dict = dict ()
@@ -904,3 +916,42 @@ def do_create_item(player: Player, parsed: base.ParseResult, ctx: util.Context)
904916 player .tell (item .name + ' added.' , evoke = False )
905917 else :
906918 raise ParseError ("Item could not be added" )
919+
920+ @wizcmd ("set_rp_prompt" )
921+ def do_set_rp_prompt (player : Player , parsed : base .ParseResult , ctx : util .Context ) -> None :
922+ """Set a temporary prompt for roleplaying. Takes both a prompt for the target, and a description of the 'effect'.
923+ Any MudObject can have a roleplay prompt, including locations.
924+ Usage: set_rp_prompt <target> <prompt> <effect description> [<time in seconds>]
925+ If time is not given, the prompt will be permanent until changed again.
926+
927+ """
928+
929+ if len (parsed .args ) < 1 :
930+ raise ParseError ("You need to specify a target" )
931+ try :
932+ target = player .location .search_living (parsed .args [0 ])
933+ if not target :
934+ target = player .search_item (parsed .args [0 ], include_inventory = True , include_location = True )
935+ if not target :
936+ target = player .location if player .location .name == parsed .args [0 ] else None
937+ if not target :
938+ raise ParseError ("Target not found" )
939+
940+ if (parsed .unparsed .count (' ' ) == 0 ):
941+ raise ParseError ("You need to specify a prompt and a description" )
942+
943+ unparsed_args = parsed .unparsed .split (' ' , 1 )[1 ].split (',' )
944+ if len (unparsed_args ) < 2 :
945+ raise ParseError ("You need to specify a prompt and a description" )
946+ prompt = unparsed_args [0 ].strip ()
947+ effect_description = unparsed_args [1 ].strip ()
948+
949+ if len (unparsed_args ) == 3 :
950+ time = float (unparsed_args [2 ].strip ())
951+ else :
952+ time = - 1
953+
954+ target .set_roleplay_prompt (prompt , effect_description , time )
955+ player .tell ("RP prompt set to: %s with effect: %s" % (prompt , effect_description ))
956+ except ValueError as x :
957+ raise ActionRefused (str (x ))
0 commit comments