EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Basic if/elsif syntax - What am I doing wrong? (https://www.eqemulator.org/forums/showthread.php?t=38882)

zerjz3 10-13-2014 04:12 PM

Basic if/elsif syntax - What am I doing wrong?
 
I am trying to get an NPC to respond differently to a player if they are holding a certain item, which I have finally gotten to work - problem is, now my other possible dialogue for the NPC, responding to the word 'drink' isn't working. I'm sure it's a basic error that I've made, just can't figure out what exactly went wrong.

Code:

sub EVENT_SAY {

if ($text =~/Hail/i){
if(plugin::check_hasitem($client, 2487)) {
quest::say ("White fish, light salt, extra lemon slices.");
}
else {
quest::emote ("stares down at the floor, clearly nervous about being in a room full of people.");
quest::say ("It's just so scary. A murder.... in my own home. Just terrifying!");
quest::emote ("wipes tears from her eyes with a silken handkerchief.");
}
if ($text =~/drink/i){
quest::say ("I don't know why I'm telling you this, stranger, but I've never touched a drop of alcohol in my life. But, oh... darn it all! I'll have some... um.. I'll have some white wine.");
quest::emote ("nervously glances at her mother, and then quickly back at the ground.");
quest::say ("Um... Bishop... would you like to come to our prayer group next week? We would love to have you there. You've been a big help to me. Um... us. You've done a lot for the family, I mean.");
}
}


Kingly_Krab 10-13-2014 04:16 PM

I believe you were missing a right curly, formatting is king.
Code:

sub EVENT_SAY {
    if ($text=~/Hail/i){
        if(plugin::check_hasitem($client, 2487)) {
            plugin::Whisper("White fish, light salt, extra lemon slices.");
        } else {
            quest::emote("stares down at the floor, clearly nervous about being in a room full of people.");
            plugin::Whisper("It's just so scary. A murder.... in my own home. Just terrifying!");
            quest::emote("wipes tears from her eyes with a silken handkerchief.");
        }
    } elsif ($text =~/^Drink$/i){
        plugin::Whisper("I don't know why I'm telling you this, stranger, but I've never touched a drop of alcohol in my life. But, oh... darn it all! I'll have some... um.. I'll have some white wine.");
        quest::emote("nervously glances at her mother, and then quickly back at the ground.");
        plugin::Whisper("Um... Bishop... would you like to come to our prayer group next week? We would love to have you there. You've been a big help to me. Um... us. You've done a lot for the family, I mean.");
    }
}


zerjz3 10-13-2014 04:19 PM

Thanks - that fixed it.

Kingly_Krab 10-13-2014 04:20 PM

You're welcome.


All times are GMT -4. The time now is 05:29 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.