View Single Post
  #3  
Old 04-01-2004, 10:41 AM
RangerDown
Demi-God
 
Join Date: Mar 2004
Posts: 1,066
Default

You're closing and reopening braces in what should be the middle of what it executes, and this might be causing it to evaluate the if() part wrong. Below is your code with my comments to show how I predict the system is gonna execute the code (I've broken up the lines differently than what you submitted so you can see my comments more easily):


Quote:
if($1-=~"want to become pvp")
{ say("I'll set your guild");
setguild(3,0);
} # This closing bracket ends what it will execute for the player saying "want to become pvp". Why did you end it here? Shouldn't the other 3 statements below also be a part of this condition?
{ say ("Now i'll set your pvp flag");
pvp(on);
} # Again, why end it here? Shouldn't the next statement below also be a part of this condition?
{say ("there you go, have fun!");
}

elsif($1-=~"want to return")
# Since you ended the if() statement way back up there, and executed more statements
# after the if(){} block, Perl's probly wondering what this elsif goes to.
# THIS is probly the root of your problem.
{say("so be it, first i'll remove you from the guild");
setguild(0,0);
} # Shouldn't be closing the bracket here
{say ("then i'll remove your precious pvp flag, you may need to zone once I do, it may say you follow the ways of discord, but just zone and you'll be fine");
pvp(off);
} # This is the right spot to close the bracket

So here's what I propose your code look like:
Quote:
if($1-=~"want to become pvp")
{ say("I'll set your guild");
setguild(3,0); # Notice there's no closing brace here
say ("Now i'll set your pvp flag");
pvp(on);
say ("there you go, have fun!");
} # <--- The if() condition doesn't end till here.

elsif($1-=~"want to return") # NOW Perl should properly evaulate this elsif()
{say("so be it, first i'll remove you from the guild");
setguild(0,0); # No closing brace here.
say ("then i'll remove your precious pvp flag, you may need to zone once I do, it may say you follow the ways of discord, but just zone and you'll be fine");
pvp(off);
} # End the elsif() part
Reply With Quote