View Single Post
  #5  
Old 03-06-2012, 08:31 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

I was thinking something like this (untested):

Code:
my $GuildName = '';
my $GuildLeader = '';

sub EVENT_TIMER {
  quest::stoptimer("cooldown");
  quest::say("$GuildLeader, just come back when you think of a good [name] for your guild.");
  $GuildName = '';
  $GuildLeader = '';
}

sub EVENT_SAY {
  if (defined($qglobals{newguild}) && ($qglobals{newguild} == 1)) {
    if (($GuildLeader eq '') || ($GuildLeader eq $name)) {
      if ($text =~ /name/i) {
        quest::say("Ok, $name. What is the name of the guild you would like to create?");
        $GuildLeader = $name;
        quest::settimer("cooldown", 60);
      }
      elsif (($text =~ /^yes$/i) && ($GuildLeader eq $name)) {
        quest::say("Ok, $name. Your guild will be called $GuildName. Congratulations!");
        quest::CreateGuild(guild_name, leader);
        quest::ding();
        quest::delglobal("newguild");
        quest::stoptimer("cooldown");
        $GuildName = '';
        $GuildLeader = '';
      }
      elsif (($text =~ /^no$/i) && ($GuildLeader eq $name)) {
        quest::say("Ok, $name. Your guild will not be called $GuildName. Just let me know when you come up with a good [name] for your guild.");
        $GuildName = '';
        $GuildLeader = '';
      }
      else {
        $GuildName = $text;
        quest::say("Ok, $name. You want your guild to be called $GuildName? You must tell me 'yes' or 'no' to continue.");
      }
    }
    else {
      quest::say("Sorry, $name. Let me finish with $GuildLeader first.");
    }
  }
  else {
    if ($text =~ /hail/i) {
      quest::say("Hello there, I'm XYZ the Headmaster for Guild Creation. Are you intrested in creating a [guild]?");
    }
    elsif ($text =~ /guild/i) {
      quest::say("I'd like to help you create a guild, however I'm going to need a few items to make this happen. Bring me the feather of the Mighty Griffon Grimfeather from North Karana and Paw of Fippy Darkpaw from Qeynos.");
    }
  }
}

sub EVENT_ITEM {
  if (plugin::check_handin(\%itemcount, 19113 => 1, 16498 => 1)) {
    quest::emote("cheers enthusiastically.");
    quest::say("Excellent work, $name. I can now help you to create a guild. Let me know when you would like to [name] your guild.");
    quest::setglobal("newguild", 0, 1, "F");
  }
  else {
    quest::say("I do not need this.");
    plugin::return_items(\%itemcount);
  }
}
Reply With Quote