barney.scr

lima-1.0b5/lib/domains/lpscript/barney.scr · 1.4 KB

From the archive lima-1.0b5+driver.tar.gz

Download the archive   « Back to the archive contents

# Do not remove the headers from this file! see /USAGE for more info.



is=living,actor

variables=emotes, adverbs, strings
name=barney
gender=male
proper_name=Barney the dinosaur
in_room_desc=Barney the dinosaur
long=It's everyones favorite dinosaur!

setup:
 lpc
  _emotes=SOUL_D->list_emotes();
  _adverbs=SOUL_D->get_adverbs();
  call_out( (:do_my_thing:), 5);
 end
---
string *strings = ({
    "The wrath of the almighty Barney!",
    "hap*"
});

string find_target() {
    object *who = users() & all_inventory(environment());
    if (!sizeof(who)) return this_object()->query_id()[0];
    return who[random(sizeof(who))]->query_userid();
}

void do_my_thing() {
    string which = _emotes[random(sizeof(_emotes))];
    string *rules = keys(SOUL_D->query_emote(which));
    string rule = rules[random(sizeof(rules))];
    object *who = users();
    string comm, token;
    
    if (!environment()) return;

    simple_action("$N $vdecide to try the '$o $o1' emote.",
		  which, rule);
    
    comm = which;
    foreach (token in explode(rule, " ")) {
	comm += " ";
	switch (token) {
	case "OBJ":
	case "LIV":
	    comm += find_target();
	    break;
	case "STR":
	    if (random(2))
		comm += strings[random(sizeof(strings))];
	    else
		comm += _adverbs[random(sizeof(_adverbs))];
	    break;
	default:
	    comm += token;
	}
    }
    do_game_command(comm);
    call_out( (: do_my_thing :), 5);
}

Site Stats

Snippets: 1791
Codebases: 571