LPMuds.net

Lib Discussion => Dead Souls Support => Topic started by: SonyUSA on April 29, 2008, 05:59:39 pm

Title: SC/status while asleep?
Post by: SonyUSA on April 29, 2008, 05:59:39 pm
Hello, I tried to modify

Code: [Select]
   if(this_player()->GetSleeping() > 0) {
        if(verb != "wake") {
            this_player()->eventPrint("You are asleep.");
            return 1;
        }
    }

so that it was

Code: [Select]
   if(this_player()->GetSleeping() > 0) {
        if(verb != "wake", "sc", "status") {
            this_player()->eventPrint("You are asleep.");
            return 1;
        }
    }

but it didnt seem to like that... do i need to use the 'and' syntax or... ?
Title: Re: SC/status while asleep?
Post by: cratylus on April 29, 2008, 06:32:03 pm
Quote
do i need to use the 'and' syntax

correct.

-Crat
Title: Re: SC/status while asleep?
Post by: daelaskai on April 29, 2008, 10:07:40 pm
Heh,

While Cratylus is correct, I think an example of the correct code would be useful.  There are two ways that I know of that this can be done.  First:

Code: [Select]
   if(this_player()->GetSleeping() > 0) {
        if( verb != "wake" && verb != "sc" && verb != "status") {
            this_player()->eventPrint("You are asleep.");
            return 1;
        }
    }

The second way I actually like better but it's personal preference, really.

Code: [Select]
   if(this_player()->GetSleeping() > 0) {
        if( member_array( verb, ({ "wake", "sc", "status" }) ) == -1 ) {
            this_player()->eventPrint("You are asleep.");
            return 1;
        }
    }

Both have the same results.

Daelas
Title: Re: SC/status while asleep?
Post by: SonyUSA on April 30, 2008, 12:06:50 am
Awesome, thanks :)