Introducing the first true script minigame....

Forum Archive - from http://theuniversal.net
Locked
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Introducing the first true script minigame....

Post by zaroba »

...thats usable on ANY world...BLACKJACK!

This is a simple blackjack game that that i've been working on. this simple version lacks
many of the features of a real blackjack game, but heck. it does work. it is designed to
be easy for the player to win against (to be honest i barely know of a way to make it
harder :P )

in this version, the cards are randomly decided at the start, the script will automatically
check and change a player's Aces from a value of 11 to a value of 1 to prevent them
from going over 21. it doesn't for the dealer, thus making it slightly easier for the player.

the script is operated by 3 & commands, uses 3 script slots (can have upto 64
scripts on a world), and uses 14 player variables. variables 1 threw 5 are the players
cards, 6 is the players current deck total, 7 is the number of cards the player currently
has. 10 threw 17 are the same as 1 threw 7, except there for the dealer, and except
for variable 15 which is the money given to the player for winning the game. This game
also checks to make sure a player doesn't already have a game in progress before
letting them start a new one. if they do already have a game started, they will continue
playing it. theoretically, this would allow people to crash and resume there game or put
it on hold if needed.

I am in the process of making a more complex version that does do the ace check for
the dealer, it will be 5 to 10 times longer. also am setting it up so it records the number
of global wins and losses, along with players personal wins/losses. it will also possibly
allow players to type in how much they want to bet on the game.

Code: Select all

Event( "&command", "Blackjack" )
{
*msg %player% Welcome to Blackjack!
*msg %player% Please read the Blackjack guide for info on how to play.
*grantitem %player% 1 Blackjack Guide
if ( $PlayerVar[1] = 0)
	{
	$PlayerVar[1] = rand(10) + 1
	$PlayerVar[2] = rand(10) + 1
	$PlayerVar[3] = rand(10) + 1
	$PlayerVar[4] = rand(10) + 1
	$PlayerVar[5] = rand(10) + 1
	$PlayerVar[6] = $PlayerVar[1] + $PlayerVar[2]
	$PlayerVar[7] = 2
	$PlayerVar[10] = rand(10) + 1
	$PlayerVar[11] = rand(10) + 1
	$PlayerVar[12] = rand(10) + 1
	$PlayerVar[13] = rand(10) + 1
	$PlayerVar[14] = rand(10) + 1
	$playervar[15] = 200
	$playervar[16] = $playervar[10] + $playervar[11]
	$PlayerVar[17] = 2
	*msg %player% Your cards are $PlayerVar[1] and $PlayerVar[2]
	*msg %player% One of the dealers cards is a $PlayerVar[10]
	if ($PlayerVar[6] = 21)
		{
		*msg %player% Congratulations!  you have 21! You should Stand.
		}
	else
		{
		*msg %player% Your total card value is $PlayerVar[6]
		*msg %player% Would you like to Hit or Stand?
		}
	}
else
	{
	*msg %player% You already have a blackjack game in progress.
	*msg %player% Your total card value is $PlayerVar[6]
	*msg %player% Would you like to Hit or Stand?
	}
}

Event( "&command", "Hit" )
{
if ($PlayerVar[7] = 2)
	{
	*msg %player% Your cards are $PlayerVar[1], $PlayerVar[2], $PlayerVar[3]
	$PlayerVar[6] = $PlayerVar[6] + $PlayerVar[3]
	$PlayerVar[7] = 3
	if ($PlayerVar[6] > 21)
		{
		if ($PlayerVar[1] = 11)
			{
			$PlayerVar[1] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Your total card value is $PlayerVar[6]
			*msg %player% Would you like to Hit or Stand?
			}
		else if ($PlayerVar[2] = 11)
			{
			$PlayerVar[2] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Your total card value is $PlayerVar[6]
			*msg %player% Would you like to Hit or Stand?
			}
		else if ($PlayerVar[3] = 11)
			{
			$PlayerVar[3] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Your total card value is $PlayerVar[6]
			*msg %player% Would you like to Hit or Stand?
			}
		else
			{
			*msg %player% You have gone over 21.  You Lose.  Better luck next time.
			$PlayerVar[1] = 0
			}
		}
	else
		{
		*msg %player% Your total card value is $PlayerVar[6]
		*msg %player% Would you like to Hit or Stand?
		}
	}
else if ($PlayerVar[7] = 3)
	{
	*msg %player% Your cards are $PlayerVar[1], $PlayerVar[2], $PlayerVar[3], $PlayerVar[4]
	$PlayerVar[6] = $PlayerVar[6] + $PlayerVar[4]
	$PlayerVar[7] = 4
	if ($PlayerVar[6] > 21)
		{
		if ($PlayerVar[1] = 11)
			{
			$PlayerVar[1] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Your total card value is $PlayerVar[6]
			*msg %player% Would you like to Hit or Stand?
			}
		else if ($PlayerVar[2] = 11)
			{
			$PlayerVar[2] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Your total card value is $PlayerVar[6]
			*msg %player% Would you like to Hit or Stand?
			}
		else if ($PlayerVar[3] = 11)
			{
			$PlayerVar[3] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Your total card value is $PlayerVar[6]
			*msg %player% Would you like to Hit or Stand?
			}
		else if ($PlayerVar[4] = 11)
			{
			$PlayerVar[4] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Your total card value is $PlayerVar[6]
			*msg %player% Would you like to Hit or Stand?
			}
		else
			{
			*msg %player% You have gone over 21.  You Lose.  Better luck next time.
			$PlayerVar[1] = 0
			}
		}
	else
		{
		*msg %player% Your total card value is $PlayerVar[6]
		*msg %player% Would you like to Hit or Stand?
		}
	}
else
	{
	*msg %player% Your cards are $PlayerVar[1], $PlayerVar[2], $PlayerVar[3], $PlayerVar[4], $PlayerVar[5]
	$PlayerVar[6] = $PlayerVar[6] + $PlayerVar[5]
	$PlayerVar[7]=5
	if ($PlayerVar[6] > 21)
		{
		if ($PlayerVar[1] = 11)
			{
			$PlayerVar[1] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Congradulations!  You have won due to the 5 card rule!
			*grantcash %player% $PlayerVar[1]
			$PlayerVar[1] = 0
			}
		else if ($PlayerVar[2] = 11)
			{
			$PlayerVar[2] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Congradulations!  You have won due to the 5 card rule!
			*grantcash %player% $PlayerVar[1]
			$PlayerVar[1] = 0
			}
		else if ($PlayerVar[3] = 11)
			{
			$PlayerVar[3] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Congradulations!  You have won due to the 5 card rule!
			*grantcash %player% $PlayerVar[1]
			$PlayerVar[1] = 0
			}
		else if ($PlayerVar[4] = 11)
			{
			$PlayerVar[4] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Congradulations!  You have won due to the 5 card rule!
			*grantcash %player% $PlayerVar[1]
			$PlayerVar[1] = 0
			}
		else if ($PlayerVar[5] = 11)
			{
			$PlayerVar[5] = 1
			$PlayerVar[6] = $PlayerVar[6] - 10
			*msg %player% Your Ace had to be changed to a value of 1 instead of 11 to prevent you from going over 21
			*msg %player% Congradulations!  You have won due to the 5 card rule!
			*grantcash %player% $PlayerVar[1]
			$PlayerVar[1] = 0
			}
		else
			{
			*msg %player% You have gone over 21.  You Lose.  Better luck next time.
			$PlayerVar[1] = 0
			}
		}
	else
		{
		*msg %player% Congradulations!  You have won due to the 5 card rule!
		*grantcash %player% $PlayerVar[1]
		$PlayerVar[1] = 0
		}
	}
}



Event( "&command", "Stand" )
{
*msg %player% You have decided to Stand with a total card value of $PlayerVar[6]
*msg %player% It is now the dealers turn to play.
*msg %player% The dealers cards are $playervar[10] and $playervar[11]
if ($PlayerVar[16] > 16)
	{
	sleep(20)
	*msg %player% The dealer decides to Stand with a total value of $playervar[16]
	if ($PlayerVar[16] > $PlayerVar[6])
		{
		*msg %player% Unfortunatly the dealer has won this round.
		*msg %player% better luck next time.
		$PlayerVar[1] = 0
		}
	else if ($PlayerVar[16] = $PlayerVar[6])
		{
		*msg %player% The game is a tie, there is no winner.  Atleast you diden't loose anything.
		*msg %player% Feel free to try again.
		*grantcash player $playervar[15]
		$PlayerVar[1] = 0
		}
	else
		{
		*msg %player% Congradulations!  you have won this hand!
		*msg %player% You have won $playervar[15] Deneri!
		*grantcash %player% $playervar[15]
		$PlayerVar[1] = 0
		}
	}
else
	{
	Sleep(20)
	*msg %player% The dealer hits.  his cards are now $PlayerVar[10], $PlayerVar[11], and $PlayerVar[12]
	$Playervar[16] = $Playervar[16] + $PlayerVar[12]
	if ($PlayerVar[16] > 16)
		{
		if ($PlayerVar[16] > 21)
			{
			*msg %player% The dealer has gone over 21!  you have won this hand!  Congratulations
			*msg %player% You have won $playervar[15] Deneri!
			*grantcash %player% $playervar[15]
			$PlayerVar[1] = 0
			}	
		else	
			{
			sleep(20)
			*msg %player% The dealer decides to Stand with a total value of $playervar[16]
			if ($PlayerVar[16] > $PlayerVar[6])
				{
				*msg %player% Unfortunatly the dealer has won this round.
				*msg %player% better luck next time.
				$PlayerVar[1] = 0
				}
			else if ($PlayerVar[16] = $PlayerVar[6])
				{
				*msg %player% The game is a tie, there is no winner.  Atleast you diden't loose anything.
				*msg %player% Feel free to try again.
				*grantcash player $playervar[15]
				$PlayerVar[1] = 0
				}
			else
				{
				*msg %player% Congratulations!  you have won this hand!
				*msg %player% You have won $playervar[15] Deneri!
				*grantcash %player% $playervar[15]
				$PlayerVar[1] = 0
				}	
			}
		}
	else
		{
		Sleep(20)
		*msg %player% The dealer hits.  his cards are now $PlayerVar[10], $PlayerVar[11], $PlayerVar[12], and $PlayerVar[13]
		$Playervar[16] = $Playervar[16] + $PlayerVar[13]
		if ($PlayerVar[16] > 16)
			{
			if ($PlayerVar[16] > 21)
				{
				*msg %player% The dealer has gone over 21!  you have won this hand!  Congratulations
				*msg %player% You have won $playervar[15] Deneri!
				*grantcash %player% $playervar[15]
				$PlayerVar[1] = 0
				}	
			else	
				{
				sleep(20)
				*msg %player% The dealer decides to Stand with a total value of $playervar[16]
				if ($PlayerVar[16] > $PlayerVar[6])
					{
					*msg %player% Unfortunatly the dealer has won this round.
					*msg %player% better luck next time.
					$PlayerVar[1] = 0
					}
				else if ($PlayerVar[16] = $PlayerVar[6])
					{
					*msg %player% The game is a tie, there is no winner.  Atleast you diden't loose anything.
					*msg %player% Feel free to try again.
					*grantcash player $playervar[15]
					$PlayerVar[1] = 0
					}
				else
					{
					*msg %player% Congratulations!  you have won this hand!
					*msg %player% You have won $playervar[15] Deneri!
					*grantcash %player% $playervar[15]
					$PlayerVar[1] = 0
					}	
				}
			}
		else
			{
			Sleep(20)
			*msg %player% The dealer hits.  his cards are now $PlayerVar[10], $PlayerVar[11], $PlayerVar[12], $PlayerVar[13], and $PlayerVar[14]
			$Playervar[16] = $Playervar[16] + $PlayerVar[14]
			if ($PlayerVar[16] > 21)
				{
				*msg %player% The dealer has gone over 21!  you have won this hand!  Congratulations
				*msg %player% You have won $playervar[15] Deneri!
				*grantcash %player% $playervar[15]
				$PlayerVar[1] = 0
				}	
			else	
				{
				*msg %player% The dealer wins by default due to the 5 card rule.
				*msg %player% Better luck next time.
				$PlayerVar[1] = 0
				}
			}
		}
	}
}


the Blackjack Guide thats granted to the player at the start of the script is a book item.
on ciroz, its text is simply:

Code: Select all

Welcome to the blackjack playguide.

Rules:
the rules of the game are simple.  get as close to 21 as you can
without going over.  then, if your card value is higher then the
dealers, you win.  If you go over 21 and have an ace (11) in your
hand, it will automatically be changed to a 1 to prevent you from
loosing the game.  however, this is not yet done for the dealer.

Commands:
type &blackjack to start a new game
type &hit to hit (get another card)
type &stand to stand (end your turn and let the dealer play)
don't ask me on how to set it up. i haven't yet gotten it working. but then, i haven't tried much either



*me puts in a line to make the post wider so the script lines don't wrap.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(sorry to anybody with a low resolution monitor)
User avatar
morbydvisns
Posts: 1889
Joined: Sun Jan 30, 2005 12:51 am

Post by morbydvisns »

Went thru this and cleaned up a few things i missed. You can change the building # to your needs. the variables by default use playervar40 - 54 or 55, if you need to change them check the descriptions their pretty clear.

Basically, the use item starts the game.. picks at random a predefined sequence needed to select the building triggers in. by default, it tells the player which one is correct as they go. You can find that line and delete it if you want to up the difficulty level for it, and if you can figure out the pattern to how its written, add up to 6 more buildings to throw in the mix pretty easily. &trigpay gives payout per # of sequences correct, within the time limit.. else when time expires, autopayout. shecks and kudos are given.

Code: Select all

///////------------------Triggers Subgame--------/////////////
//-------Variables (-----set playervars you want to use here-----)//
/////////////****Notice****///////////  Dont forget to put your name (Planet Owners Name) in the &trigstats script event at the bottom part of the game script!//////////////

$trigcheck = 40		        // used to keep players from running multiple subgames
$TrigCode1 = 51         // 
$TrigCode2 = 52		// - trigger sequence to win	           
$TrigCode3 = 53		//                 
$TrigCode4 = 54		// 		   
$TrigPlayed1 = 41		//	 recommended not to change, unless you know exactly whats going on. Theres a hard coded formula in each of the building trigger scripts that get these vars #'s
$TrigPlayed2 = 42		//	
$TrigPlayed3 = 43		// - player selected sequences
$TrigPlayed4 = 44		//
$TrigMatch = 48
$TrigFail = 46
$TrigMode = 47		//	determines what sequence is used for code variables
$TrigCnt = 45		        //	tracks how many triggers player has activated per round
$TrigTries = $trigfail + 1
$TrigRoundWins = 49	        //	- tracks for payout, wins per session, resets after payout/time up
$TrigtotalWins = 50	//   	- tracks players total wins per life, does not reset in script
$ShekPay = $playervar[$trigroundwins] * 400                    //  Payout calculator, edit to your likings 
$KudosPay = $playervar[$trigroudnwins] * 1                     // ***These are used in the script, &trigpay script and the game activator script for some reason.
$sheks = ($shekpay / 10)           // Your worlds d per shek   \\  If you want try removing those to see if it still works with these but i wont for now because it works how it  is XD
//-=----------------=----------------=---------------------


        // ----------======  Subgame Trigger Bldgs


Event( "BuildingTriggered", "18" )
{
if ( $playervar[$trigcheck] = 1 )
 {
*msg %player% Activated Trigger 1!
$playervar[$TrigCnt] = $playervar[$TrigCnt] + 1
*setplayervar %player% 4%playervar45% 1
 if ( $playervar[$TrigCnt] = 4 )
  {
  *msg %player% Trigger Sequence Attempt Complete..   Verifying results...
   sleep (50)
  if ( $playervar[$trigplayed1] = $playervar[$trigcode1] )
   {
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	  *msg %Player% First Trigger Selection Correct
	sleep(25)
   }
	if ( $playervar[$trigplayed2] = $playervar[$trigcode2] )
   {
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Second Trigger Selection Correct
	sleep(25)
   }
	if ( $playervar[$trigplayed3] = $playervar[$trigcode3] )
   {
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Third Trigger Selection Correct
	sleep(25)
   }
	if ( $playervar[$trigplayed4] = $playervar[$trigcode4] )
   {
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Fourth Trigger Selection Correct
	sleep(25)
   }
	 if ($playervar[$TrigMatch] = 4 )
   {
	  *msg %player% Congratulaions, you solved the puzzle!
       $playervar[$trigroundwins] = $playervar[$trigroundwins] + 1
	$playervar[$TrigTotalWins] = $playervar[$TrigTotalWins] + 1
	$TrigtotalWins = ($TrigtotalWins + 1)
       Sleep (30)
          *msg %player%	
	  *say %player% solved the puzzle after %playervar[$TrigFail]% failed tries!
	*msg %player% You may play as many times within the time limit.. the sequence will be randomized again.
	*msg %player% Awards will be payed out after the game time limit has expired.
	*msg %player% You can type &trigpay at anytime for early end and payout.
	$playervar[$TrigMode] = Rand(6)
	$playervar[$TrigPlayed1] = 0
	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
	$playerVar[$TrigMatch] = 0
	$playervar[$TrigFail] = 0
        if ( $playervar[$TrigMode] = 1 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 3
   }
    if ( $playervar[$TrigMode] = 2 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 2
   }
   if ( $playervar[$TrigMode] = 3 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 3
   }
   if ( $playervar[$TrigMode] = 4 )
   {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
   }
   if ( $playervar[$TrigMode] = 5 )
   {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 4
   }
	  if ( $playervar[$TrigMode] = 6 )
   {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 1
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 4
   }
  	  if ( $playervar[$TrigMode] = 7 )
   {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 1
   }
    	if ( $playervar[$TrigMode] = 8 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
   }
  	 if ( $playervar[$TrigMode] = 9 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 3
   	  
   }
         if ( $playervar[$TrigMode] = 10 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 2
   	  
   }
  }
 else
   {
	*msg %player% Sorry, that was not correct..  you had %playervar[$trigmatch]% correct. Try again
	$playervar[$TrigFail] = $playervar[$TrigFail] + 1
        $playervar[$TrigPlayed1] = 0
	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
	$playerVar[$TrigMatch] = 0
	$playervar[$trigfail] = $playervar[$trigfail] + 1
    
   }
  }
 }
else 
 { 
 *msg %Player% Triggers Event must be running to use this. 
 }
}

Event( "BuildingTriggered", "19" )
{
if ( $playervar[$trigcheck] = 1 )
 {
*msg %player% Activated Trigger 2!
$playervar[$TrigCnt] = $playervar[$TrigCnt] + 1
*setplayervar %player% 4%playervar45% 2
 if ( $playervar[$TrigCnt] = 4 )
   {
  *msg %player% Trigger Sequence Attempt Complete..   Verifying results...
   sleep (50)
	if ( $playervar[$trigplayed1] = $playervar[$trigcode1] )
   	{
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	  *msg %Player% First Trigger Selection Correct
	sleep(25)
	}
	if ( $playervar[$trigplayed2] = $playervar[$trigcode2] )
   	{
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Second Trigger Selection Correct
	sleep(25)
	}
	if ( $playervar[$trigplayed3] = $playervar[$trigcode3] )
   	{
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Third Trigger Selection Correct
	sleep(25)
	}
	if ( $playervar[$trigplayed4] = $playervar[$trigcode4] )
   	{
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Fourth Trigger Selection Correct
	sleep(25)
	}
	 if ($playervar[$TrigMatch] = 4 )
	{
	  *msg %player% Congratulaions, you solved the puzzle!
	$playervar[$trigroundwins] = $playervar[$trigroundwins] + 1
	$playervar[$TrigTotalWins] = $playervar[$TrigTotalWins] + 1
       Sleep (30)
          *msg %player%	
	  *say %player% solved the puzzle after %playervar[$TrigFail]% failed tries!
	*msg %player% You may play as many times within the time limit.. the sequence will be randomized again.
	*msg %player% Awards will be payed out after the game time limit has expired.
	*msg %player% You can type &trigpay at anytime for early end and payout.
	$playervar[$TrigMode] = Rand(6)
	$playervar[$TrigPlayed1] = 0
	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
	$playerVar[$TrigMatch] = 0
	$playervar[$TrigFail] = 0
	if ( $playervar[$TrigMode] = 1 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 3
   }
    if ( $playervar[$TrigMode] = 2 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 2
   }
   if ( $playervar[$TrigMode] = 3 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 3
   }
   if ( $playervar[$TrigMode] = 4 )
   {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
   }
   if ( $playervar[$TrigMode] = 5 )
   {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 4
   }
	  if ( $playervar[$TrigMode] = 6 )
   {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 1
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 4
   }
  	  if ( $playervar[$TrigMode] = 7 )
   {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 1
   }
    	if ( $playervar[$TrigMode] = 8 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
   }
  	 if ( $playervar[$TrigMode] = 9 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 3
   	  
   }
         if ( $playervar[$TrigMode] = 10 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 2
   	  
   }
  }
 	else
	{
	*msg %player% Sorry, that was not correct..  you had %playervar[$trigmatch]% correct. Try again
	$playervar[$TrigFail] = $playervar[$TrigFail] + 1
        $playervar[$TrigPlayed1] = 0
	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
	$playervar[$Trigmatch] = 0
	$playervar[$trigfail] = $playervar[$trigfail] + 1
	}
     }
}
    else
   { 
   *msg %Player% Triggers Event must be running to use this.
   }
}
	

Event( "BuildingTriggered", "20" )
{
 if ( $playervar[$trigcheck] = 1 )
 {
*msg %player% Activated Trigger 3!
$playervar[$TrigCnt] = $playervar[$TrigCnt] + 1
*setplayervar %player% 4%playervar45% 3
 if ( $playervar[$TrigCnt] = 4 )
   {
  *msg %player% Trigger Sequence Attempt Complete..   Verifying results...
   sleep (50)
	if ( $playervar[$trigplayed1] = $playervar[$trigcode1] )
   	{
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	  *msg %Player% First Trigger Selection Correct
	sleep(25)
	}
	if ( $playervar[$trigplayed2] = $playervar[$trigcode2] )
   	{
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Second Trigger Selection Correct
	sleep(25)
	}
	if ( $playervar[$trigplayed3] = $playervar[$trigcode3] )
   	{
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Third Trigger Selection Correct
	sleep(25)
	}
	if ( $playervar[$trigplayed4] = $playervar[$trigcode4] )
   	{
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Fourth Trigger Selection Correct
	sleep(25)
	}
	 if ($playervar[$TrigMatch] = 4 )
	{
	  *msg %player% Congratulaions, you solved the puzzle!
 	$playervar[$trigroundwins] = $playervar[$trigroundwins] + 1
	$playervar[$TrigTotalWins] = $playervar[$TrigTotalWins] + 1
       Sleep (30)
          *msg %player%	
	  *say %player% solved the puzzle after %playervar[$TrigFail]% failed tries!
	*msg %player% You may play as many times within the time limit.. the sequence will be randomized again.
	*msg %player% Awards will be payed out after the game time limit has expired.
	*msg %player% You can type &trigpay at anytime for early end and payout.
	$playervar[$TrigMode] = Rand(6)
	$playervar[$TrigPlayed1] = 0
	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
	$playerVar[$TrigMatch] = 0
	$playervar[$TrigFail] = 0
        if ( $playervar[$TrigMode] = 1 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 3
   }
    if ( $playervar[$TrigMode] = 2 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 2
   }
   if ( $playervar[$TrigMode] = 3 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 3
   }
   if ( $playervar[$TrigMode] = 4 )
   {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
   }
   if ( $playervar[$TrigMode] = 5 )
   {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 4
   }
	  if ( $playervar[$TrigMode] = 6 )
   {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 1
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 4
   }
  	  if ( $playervar[$TrigMode] = 7 )
   {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 1
   }
    	if ( $playervar[$TrigMode] = 8 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
   }
  	 if ( $playervar[$TrigMode] = 9 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 3
   	  
   }
         if ( $playervar[$TrigMode] = 10 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 2
   	  
   }
  }
 	else
	{
	*msg %player% Sorry, that was not correct..  you had %playervar[$trigmatch]% correct. Try again
	$playervar[$TrigFail] = $playervar[$TrigFail] + 1
        $playervar[$TrigPlayed1] = 0
	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
	$playerVar[$TrigMatch] = 0
	$playervar[$trigfail] = $playervar[$trigfail] + 1
	}
        }
    }
 else
   { 
   *msg %Player% Triggers Event must be running to use this.
     }
}

Event( "BuildingTriggered", "21" )
{
 if ( $playervar[$trigcheck] = 1 )
 {
*msg %player% Activated Trigger 4!
$playervar[$TrigCnt] = $playervar[$TrigCnt] + 1
*setplayervar %player% 4%playervar45% 4
 if ( $playervar[$TrigCnt] = 4 )
 {
  *msg %player% Trigger Sequence Attempt Complete..   Verifying results...
   sleep (50)
	if ( $playervar[$trigplayed1] = $playervar[$trigcode1] )
  {
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	  *msg %Player% First Trigger Selection Correct
	sleep(25)
  }
	if ( $playervar[$trigplayed2] = $playervar[$trigcode2] )
  {
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Second Trigger Selection Correct
	sleep(25)
  }
	if ( $playervar[$trigplayed3] = $playervar[$trigcode3] )
  {
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Third Trigger Selection Correct
    sleep(25)
  }
	if ( $playervar[$trigplayed4] = $playervar[$trigcode4] )
  {
	   $playervar[$trigmatch] = $playervar[$trigmatch] + 1
	*msg %Player% Fourth Trigger Selection Correct
	sleep(25)
  }
	 if ($playervar[$TrigMatch] = 4 )
  {
	  *msg %player% Congratulaions, you solved the puzzle!
 	$playervar[$trigroundwins] = $playervar[$trigroundwins] + 1
	$playervar[$TrigTotalWins] = $playervar[$TrigTotalWins] + 1
       Sleep (30)
           *msg %player%	
	  *say %player% solved the puzzle after %playervar[$TrigFail]% failed tries!
	*msg %player% You may play as many times within the time limit.. the sequence will be randomized again.
	*msg %player% Awards will be payed out after the game time limit has expired.
	*msg %player% You can type &trigpay at anytime for early end and payout.
	$playervar[$TrigMode] = Rand(6)
        $playervar[$TrigPlayed1] = 0

	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
	$playerVar[$TrigMatch] = 0
	$playervar[$TrigFail] = 0
        if ( $playervar[$TrigMode] = 1 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 3
   }
    if ( $playervar[$TrigMode] = 2 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 2
   }
   if ( $playervar[$TrigMode] = 3 )
   {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 3
   }
   if ( $playervar[$TrigMode] = 4 )
   {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
   }
   if ( $playervar[$TrigMode] = 5 )
   {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 4
   }
	  if ( $playervar[$TrigMode] = 6 )
   {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 1
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 4
   }
  	  if ( $playervar[$TrigMode] = 7 )
   {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 1
   }
    	if ( $playervar[$TrigMode] = 8 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
   }
  	 if ( $playervar[$TrigMode] = 9 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 3
   	  
   }
         if ( $playervar[$TrigMode] = 10 )
   {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 2
   	  
   }
  }
        
 	else
  {
	*msg %player% Sorry, that was not correct..  you had %playervar[$trigmatch]% correct. Try again
	$playervar[$TrigFail] = $playervar[$TrigFail] + 1
        $playervar[$TrigPlayed1] = 0
	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
	$playerVar[$TrigMatch] = 0
	$playervar{$trigfail] = $playervar[$trigfail] + 1
 	 }
  }
 }
}
else
 { 
   *msg %Player% Triggers Event must be running to use this.
 }
}

-------=====---------triggers starter item---====-
Event( "UseItem", "Runes Puzzle" )
{
canceltransaction()
 if ( $playervar102 > 0 )
 { 
  *msg %player% This is already running
 }
else
 {
        $playervar[$TrigRoundWins] = 0
        $playervar[$TrigPlayed1] = 0
	$playervar[$TrigPlayed2] = 0
	$playervar[$TrigPlayed3] = 0
	$playervar[$TrigPlayed4] = 0
	$playervar[$TrigCnt] = 0 
 	$playerVar[$TrigFail] = 0
	$playerVar[$TrigMatch] = 0
        $playervar[$TrigMode] = Rand(6)
        $playervar[$trigcheck] = 1
$playervar102 = 1
	 $playervar[$TrigRoundWins] = 0
	 Sleep (30)
	 *msg %player% Welcome to Bongo's Runes Puzzle!
	 *msg %player%  
	 *msg %player%  
 	Sleep (20)
	 *msg %player% 
	 *msg %player% Approach the 4 trigger buildings, in the proper sequence to solve this puzzle.
	 *msg %player% You can play as many times as you like in the time limit.  It will change sequence when you solve one. 
		
		Sleep (30) 
	*msg %player% you will have 60 minutes for this task. Starting Now
	 *msg %player% Good Luck! 
	*msg %player%
   	if ( $playervar[$TrigMode] = 1 )
  {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 3
  }
    if ( $playervar[$TrigMode] = 2 )
  {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 2
  }
   if ( $playervar[$TrigMode] = 3 )
  {
		$playerVar[$TrigCode1] = 1
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 3
  }
   if ( $playervar[$TrigMode] = 4 )
  {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 4
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
  }
   if ( $playervar[$TrigMode] = 5 )
  {
		$playerVar[$TrigCode1] = 2
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 4
  }
	  if ( $playervar[$TrigMode] = 6 )
  {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 1
		$playerVar[$TrigCode3] = 2
		$playerVar[$TrigCode4] = 4
  }
  	  if ( $playervar[$TrigMode] = 7 )
  {
		$playerVar[$TrigCode1] = 3
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 4
		$playerVar[$TrigCode4] = 1
  }
    	if ( $playervar[$TrigMode] = 8 )
  {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 3
		$playerVar[$TrigCode4] = 1
  }
  	 if ( $playervar[$TrigMode] = 9 )
  {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 2
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 3
   	  
  }
         if ( $playervar[$TrigMode] = 10 )
  {
		$playerVar[$TrigCode1] = 4
		$playerVar[$TrigCode2] = 3
		$playerVar[$TrigCode3] = 1
		$playerVar[$TrigCode4] = 2
   	  
  }
sleep (12000)
  *msg %player% 20 MINUTES REMAINING!
	Sleep (6000)
	if ( $playervar[$trigcheck] = 1 )
  {
  }
	else
  {
	*msg %player% 10 MINUTES REMAINING!
	sleep (6000)
  }
	if ( $playervar[$trigcheck] = 1 )
  {
  }
	else
  {
	*msg %player% Times up!
        *msg %player% Checking Quest Records to calculate rewards....
	Sleep (30)
	if ( $Playervar[$trigroudnwins] > 0 )
   {
 		$ShekPay = $playervar[$TrigRoundWins] * 400
		$KudosPay = $playervar[$trigroundwins] / 5
		 *say %Player% won $ShekPay d and $kudospay for solving %playervar49% Puzzle(s)!
 		*grantcash %player% $shekpay 
 		*grantkudos %player% $KudosPay
   }
	else if ( $playervar[$trigroudwins] = 0 )
   {	
	 *say %player% didnt solve any puzzles.  Better luck next time. 
   }
$playervar[$trigmode] = 0	
   } 
  }
 }
}  

Event( "&Command", "trignfo" )
{
*msg CHANGEME %player% TrigCode1 = %Playervar[$TrigCode1]%
*msg CHANGEME %player% TrigCode2 = %Playervar[$TrigCode2]%
*msg CHANGEME %player% TrigCode3 = %Playervar[$TrigCode3]%
*msg CHANGEME %player% TrigCode4 = %Playervar[$TrigCode4]%
*msg CHANGEME %player% TrigPlayed1 = %Playervar[$TrigPlayed1]%
*msg CHANGEME %player% TrigPlayed2 = %Playervar[$TrigPlayed2]%
*msg CHANGEME %player% TrigPlayed3 = %Playervar[$TrigPlayed3]% 
*msg CHANGEME %player% TrigPlayed4 = %Playervar[$TrigPlayed4]% 
*msg CHANGEME %player% TrigMatch = %Playervar[$TrigMatch]%
*msg CHANGEME %player% trigrFailed = %Playervar[$TrigFail]%
*msg CHANGEME %player% TrigMode = %playervar[$TrigMode]%
*msg CHANGEME %player% trigcheck = %playervar[$trigcheck]%
*msg CHANGEME %player% Triggered so far = %playervar[$TrigCnt]%
*msg CHANGEME %player% won this round = %playervar49%
*msg CHANGEME %player% In trigger mode = %playervar[$trigcheck]%

}


Event( "&command", "trigpay" )
{
if ( $playervar[$trigcheck] = 1 )
 {
$ShekPay = $playervar[$trigroundwins] * 400
$KudosPay = $playervar[$trigroundwins] / 5
$shek = $shekpay / 10
*say %Player% won $Shek S and $kudospay kudos for solving %playervar49% Puzzle(s)!
*grantcash %player% $shekpay
*grantkudos %player% $KudosPay
$playervar[$trigroundwins] = 0
$playervar[$trigcheck] = 0
 }
}

Locked