Author Topic: Multiple Word Exit names.  (Read 1864 times)

Offline shigs

  • Acquaintance
  • *
  • Posts: 37
    • View Profile
Multiple Word Exit names.
« on: October 12, 2008, 05:52:09 pm »
I wanted to have exits with multiple words. Yellow Door, Red Door etc.

So after following some advice I looked into the BARE_EXITS portion of the code, and came up with this.

Code: [Select]
    if(BARE_EXITS){
        localcmds = ({});
        filter(this_player()->GetCommands(), (: localcmds += ({ $1[0] }) :));
verag = verb + " " + args;
        if(environment(this_player())->GetExits()) {
            if(member_array(verag,environment(this_player())->GetExits()) != -1) {
verb = "go " + verag;
write(verb);
}
           
if(member_array(verag,environment(this_player())->GetEnters()) != -1) verb = "enter " + verag;
        }
    }

Now my only problem is.. For example if my room has the exit 'foo bar', when I type 'foo bar', verb contains 'go foo bar', but the mud responds with
Quote
>foo bar
go foo bar
You go nowhere at all.

Now,
typing 'go foo bar' in myself works just fine. But when its called by command.c it fails, Any ideas why?

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1024
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: Multiple Word Exit names.
« Reply #1 on: October 12, 2008, 06:06:32 pm »
This is the relevant code from Dead Souls 2.9a10 (unreleased as of now).
It seems to work fine for me, and though I haven't tested it on 2.8.4, I can't
think of any reason it should fail too badly.


Code: [Select]
    if(BARE_EXITS){
        localcmds = ({});
        filter(this_player()->GetCommands(), (: localcmds += ({ $1[0] }) :));
        if(member_array(verb,CMD_D->GetCommands()) == -1 &&
          member_array(verb,keys(VERBS_D->GetVerbs())) == -1 &&
          member_array(verb,localcmds) == -1 ){
            string dir;
            if(args) dir = verb + " " + args;
            else dir = verb;
            if(member_array(dir,environment(this_player())->GetExits()) != -1) verb = "go "+verb;
            if(member_array(dir,environment(this_player())->GetEnters()) != -1)
verb = "enter "+verb;
        }
    }