TicTacToe.sk

Created by LimeGlass

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

command /tictactoe:
	trigger:
		open dropper to player
		set {tictactoe::temp::%player%::inventory} to player's open inventory
		set {tictactoe::temp::%player%::start} to now
		chance of 50%:
			set {tictactoe::temp::%player%::turn} to true
		while {tictactoe::temp::%player%::inventory} is set:
			set {_check::*} to slots (numbers between 0 and inventory size of {tictactoe::temp::%player%::inventory}) of {tictactoe::temp::%player%::inventory}
			if {tictactoe::temp::%player%::turn} is not set:
				set {_check} to true
				while {_check} is set:
					set {_slot} to random number between 0 and inventory size of {tictactoe::temp::%player%::inventory}
					wait a tick
					if size of items in {tictactoe::temp::%player%::inventory} is 9:
						clear {_check}
					slot {_slot} of {tictactoe::temp::%player%::inventory} is air
					set slot {_slot} of {tictactoe::temp::%player%::inventory} to barrier
					clear {_check}
				play sound "ENTITY_EXPERIENCE_ORB_PICKUP" at volume 0.7 and pitch 2 to player
				set {tictactoe::temp::%player%::turn} to true
			wait 5 ticks
			clear {_win}
			if {_check::1}, {_check::2} and {_check::3} are {_check::1}:
				set {_win} to {_check::1}
			if {_check::1}, {_check::4} and {_check::7} are {_check::1}:
				set {_win} to {_check::1}
			if {_check::2}, {_check::5} and {_check::8} are {_check::2}:
				set {_win} to {_check::2}
			if {_check::1}, {_check::5} and {_check::9} are {_check::1}:
				set {_win} to {_check::1}
			if {_check::3}, {_check::5} and {_check::7} are {_check::3}:
				set {_win} to {_check::3}
			if {_check::4}, {_check::5} and {_check::6} are {_check::4}:
				set {_win} to {_check::4}
			if {_check::3}, {_check::6} and {_check::9} are {_check::3}:
				set {_win} to {_check::3}
			if {_check::7}, {_check::8} and {_check::9} are {_check::7}:
				set {_win} to {_check::7}
			if {_win} is not set:
				if size of items in {tictactoe::temp::%player%::inventory} is 9:
					set {_win} to stone
			if {_win} is set:
				{_win} is not air
				set {_time} to difference between now and {tictactoe::temp::%player%::start}
				if {_win} is a slime ball:
					message "&7[&3TicTacToe&7] &aYou have won a game! You have finished a game in %{_time}%&a, Good game!"
				else if {_win} is a barrier:
					message "&7[&3TicTacToe&7] &cYou have lost the game. You have finished a game in %{_time}%"
				else:
					message "&7[&3TicTacToe&7] &7Draw. You have finished a game in %{_time}%"
				clear {tictactoe::temp::%player%::turn}
				wait a second
				close player's inventory
on inventory click:
	{tictactoe::temp::%player%::inventory} is set
	event-inventory is {tictactoe::temp::%player%::inventory}
	cancel event
	{tictactoe::temp::%player%::turn} is set
	slot clicked slot of event-inventory is air
	play sound "ENTITY_EXPERIENCE_ORB_PICKUP" at volume 0.7 and pitch 2 to player
	set slot clicked slot of event-inventory to slime ball
	delete {tictactoe::temp::%player%::turn}
on inventory close:
	clear {tictactoe::temp::%player%::*}
on quit:
	clear {tictactoe::temp::%player%::*}
on script unload:
	delete {tictactoe::temp::*}