Create
Return to post

Comparing difference between and

View raw
  • settings
  • {
  • main
  • {
  • Description: "Bejeweled by Progresso#2749\nCode: SBEK8\nworkshop.codes/bejeweled"
  • Mode Name: "Bejeweled"
  • }
  • lobby
  • {
  • Allow Players Who Are In Queue: Yes
  • Max Spectators: 0
  • Max Team 1 Players: 1
  • Max Team 2 Players: 0
  • }
  • modes
  • {
  • Skirmish
  • {
  • enabled maps
  • {
  • Workshop Island Night 972777519512064579
  • }
  • }
  • General
  • {
  • Limit Roles: 2 Of Each Role Per Team
  • Respawn As Random Hero: On
  • }
  • }
  • heroes
  • {
  • General
  • {
  • enabled heroes
  • {
  • Zenyatta
  • }
  • }
  • }
  • }
  • variables
  • {
  • global:
  • 1: GemColors
  • 2: Settings
  • 3: Counter
  • 4: LastColor
  • 5: Matches
  • 6: I
  • 7: J
  • 8: ArrReplaceRow
  • 9: ArrReplaceCol
  • 10: ArrReplaceVal
  • 11: TempRow
  • 12: CurStreak
  • 13: Level
  • 14: Points
  • 15: IsReceivingPoints
  • 16: K
  • 17: ColorSettings
  • 18: IsInProcessing
  • 19: Temp
  • 23: Clr
  • 24: Col
  • 25: Row
  • 26: AvailableColors
  • player:
  • 1: Selection1
  • 2: Selection2
  • 3: Temp
  • 4: IsReset
  • 6: tempVect
  • 8: rotationDeg
  • 9: cursorPos
  • 10: cursor
  • 11: cursorAddrX
  • 12: cursorAddrY
  • }
  • subroutines
  • {
  • 0: GridFill
  • 2: GemColorArrReplace
  • 3: CheckRowMatches
  • 4: CheckColMatches
  • 5: ClearMatches
  • 6: FindMatches
  • 7: ClearGrid
  • 8: ReplaceGems
  • 9: GivePoints
  • 10: GemsWaterfall
  • 11: CreateGem
  • }
  • rule("Init options")
  • {
  • event
  • {
  • Ongoing - Global;
  • }
  • actions
  • {
  • "disableInspector()\n0 - Rows, 1 - Cols, 2 - Timed, 3 - Endless, 4 - gems fall 5 - Show color name 6 - alt.controls"
  • Global.Settings = Array(Workshop Setting Integer(Custom String("Grid dimensions"), Custom String("Rows"), 8, 3, 10, 0),
  • Workshop Setting Integer(Custom String("Grid dimensions"), Custom String("Columns"), 8, 3, 10, 0), Workshop Setting Toggle(
  • Custom String("General"), Custom String("Timetrial"), False, 0), Workshop Setting Toggle(Custom String("General"),
  • Custom String("Endless"), False, 0), Workshop Setting Toggle(Custom String("General"), Custom String("Gems Fall"), True, 0),
  • Workshop Setting Toggle(Custom String("Accessibility"), Custom String("​Show color name at top"), False, 0),
  • Workshop Setting Toggle(Custom String("Accessibility"), Custom String("​Use movement keys for cursor control"), False, 0));
  • Global.ColorSettings = Array(Array(Color(Red), Workshop Setting Toggle(Custom String("Colors"), Custom String("Red"), True, 0),
  • Custom String("Red")), Array(Color(Green), Workshop Setting Toggle(Custom String("Colors"), Custom String("​Green"), True, 0),
  • Custom String("Green")), Array(Color(Blue), Workshop Setting Toggle(Custom String("Colors"), Custom String("​Blue"), True, 0),
  • Custom String("Blue")), Array(Color(Purple), Workshop Setting Toggle(Custom String("Colors"), Custom String("​Purple"), True,
  • 0), Custom String("Purple")), Array(Color(White), Workshop Setting Toggle(Custom String("Colors"), Custom String("​White"),
  • True, 0), Custom String("White")), Array(Color(Orange), Workshop Setting Toggle(Custom String("Colors"), Custom String(
  • "​Orange"), True, 0), Custom String("Orange")), Array(Color(Aqua), Workshop Setting Toggle(Custom String("Colors"),
  • Custom String("​Aqua"), True, 0), Custom String("Aqua")), Array(Color(Turquoise), Workshop Setting Toggle(Custom String(
  • "Colors"), Custom String("​Turquoise"), False, 0), Custom String("Turquoise")), Array(Color(Yellow), Workshop Setting Toggle(
  • Custom String("Colors"), Custom String("​Yellow"), False, 0), Custom String("Yellow")), Array(Color(Lime Green),
  • Workshop Setting Toggle(Custom String("Colors"), Custom String("​Lime Green"), False, 0), Custom String("Lime Green")), Array(
  • Color(Rose), Workshop Setting Toggle(Custom String("Colors"), Custom String("Rose"), False, 0), Custom String("Rose")), Array(
  • Color(Violet), Workshop Setting Toggle(Custom String("Colors"), Custom String("Violet"), False, 0), Custom String("Violet")));
  • }
  • }
  • rule("Init vars")
  • {
  • event
  • {
  • Ongoing - Global;
  • }
  • conditions
  • {
  • Is Game In Progress == True;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: init"));
  • Global.I = Null;
  • Global.AvailableColors = Empty Array;
  • While(Global.I < Count Of(Global.ColorSettings));
  • If(Global.ColorSettings[Global.I][1] == True);
  • Global.AvailableColors[Count Of(Global.AvailableColors)] = Global.ColorSettings[Global.I];
  • End;
  • Global.I += 1;
  • End;
  • Global.Level = 1;
  • Global.Points = Null;
  • Global.GemColors = Empty Array;
  • Global.Matches = Empty Array;
  • Global.IsInProcessing = True;
  • Call Subroutine(GridFill);
  • "clear grid until no matches left"
  • Call Subroutine(ClearGrid);
  • Global.IsInProcessing = False;
  • Set Objective Description(All Players(All Teams), Custom String("Match Three"), Visible To Sort Order and String);
  • Create In-World Text(All Players(All Teams), Custom String("BEJEWELED"), Vector(27.500, 0.500, 15), 5, Clip Against Surfaces,
  • Visible To Position and String, Color(Purple), Visible Always);
  • Create In-World Text(All Players(All Teams), Custom String("Mode: {0} {1}", Global.Settings[2] ? Custom String("Timetrial")
  • : Custom String("Classic"), Global.Settings[3] ? Custom String("/ Endless") : Custom String("")), Vector(27.500, 0.500,
  • 13.500), 1.500, Do Not Clip, Visible To Position and String, Color(Purple), Visible Always);
  • Create In-World Text(All Players(All Teams), Custom String("Score: {0}", Global.Points), Vector(27.500, 0.500, 9), 3, Do Not Clip,
  • Visible To and String, Color(Purple), Default Visibility);
  • Create In-World Text(All Players(All Teams), Custom String("Level: {0}", Global.Level), Vector(27.500, 0.500, 11), 2,
  • Clip Against Surfaces, Visible To Position and String, Color(Purple), Visible Always);
  • Create In-World Text(All Players(All Teams), Custom String(
  • "Swap gems to make 3 same-colored gems in a row\n\n{0} / {1} - Select gem\n\n {2}", Input Binding String(Button(Primary Fire)),
  • Input Binding String(Button(Secondary Fire)), Custom String("{0} - New board (-{1} PTS {2})", Input Binding String(Button(
  • Reload)), Global.Level * 250, Global.Settings[2] ? Custom String("-30sec") : Custom String(""))), Vector(27.500, 0.500, 4), 1,
  • Clip Against Surfaces, Visible To Position and String, Color(White), Visible Always);
  • Create HUD Text(All Players(All Teams), Null, Null, Custom String("Code: SBEK8"), Right, False, Null, Null, Color(Lime Green),
  • Visible To and String, Default Visibility);
  • Create HUD Text(All Players(All Teams), Null, Null, Custom String("Created by: Progresso#2749"), Right, False, Null, Null, Color(
  • Lime Green), Visible To and String, Default Visibility);
  • Create HUD Text(All Players(All Teams), Null, Null, Custom String("workshop.codes/bejeweled"), Right, False, Null, Null, Color(
  • Lime Green), Visible To and String, Default Visibility);
  • Global.IsReceivingPoints = True;
  • If(Global.Settings[2]);
  • Set Match Time(150);
  • Else;
  • Pause Match Time;
  • }
  • }
  • rule("Init player and camera")
  • {
  • event
  • {
  • Player Joined Match;
  • All;
  • All;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: init player"));
  • Disable Hero HUD(Event Player);
  • If(!Global.Settings[2]);
  • Disable Game Mode HUD(Event Player);
  • End;
  • Set Invisible(Event Player, All);
  • Set Jump Enabled(Event Player, False);
  • Set Move Speed(Event Player, -1);
  • "disable buttons"
  • Disallow Button(Event Player, Button(Interact));
  • Disallow Button(Event Player, Button(Ability 1));
  • Disallow Button(Event Player, Button(Ability 2));
  • Disallow Button(Event Player, Button(Crouch));
  • Disallow Button(Event Player, Button(Jump));
  • Disallow Button(Event Player, Button(Melee));
  • Disallow Button(Event Player, Button(Primary Fire));
  • Disallow Button(Event Player, Button(Reload));
  • Disallow Button(Event Player, Button(Secondary Fire));
  • Disallow Button(Event Player, Button(Ultimate));
  • Start Camera(Event Player, Vector(False, 30, False), Vector(False, False, False), 0);
  • "Selection icons"
  • Event Player.Selection1 = Array(100, 100);
  • Event Player.Selection2 = Array(100, 100);
  • Create Icon(Event Player, Vector(Global.Settings[True] / 2 * 4 - Event Player.Selection1[True] * 4 - 2, 0.500, First Of(
  • Global.Settings) / 2 * 4 - First Of(Event Player.Selection1) * 4 - 2), Arrow: Down, Visible To and Position, Color(Yellow),
  • False);
  • Create Icon(Event Player, Vector(Global.Settings[True] / 2 * 4 - Event Player.Selection2[True] * 4 - 2, 0.500, First Of(
  • Global.Settings) / 2 * 4 - First Of(Event Player.Selection2) * 4 - 2), Arrow: Down, Visible To and Position, Color(Yellow),
  • False);
  • }
  • }
  • rule("cursor")
  • {
  • event
  • {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • conditions
  • {
  • Has Spawned(Event Player) == True;
  • }
  • actions
  • {
  • Teleport(Event Player, Vector(False, False, False));
  • Set Facing(Event Player, Forward, To World);
  • Event Player.cursor = Ray Cast Hit Position(Vector(False, 30, False), Vector(False, 30, False) + Event Player.cursorPos * 100,
  • Null, Null, False);
  • Create Effect(Event Player, Orb, Color(Yellow), Vector(Min(21, Max(X Component Of(Event Player.cursor), -21)), 0.500, Min(21, Max(
  • Z Component Of(Event Player.cursor), -21))), 2.500, Visible To Position and Radius);
  • Chase Player Variable At Rate(Event Player, cursorAddrY, Round To Integer(-1 * X Component Of(Event Player.cursor)
  • / 4 + Global.Settings[True] / 2 + -0.500, To Nearest), 300, Destination and Rate);
  • Chase Player Variable At Rate(Event Player, cursorAddrX, Round To Integer(-1 * Z Component Of(Event Player.cursor) / 4 + First Of(
  • Global.Settings) / 2 + -0.500, To Nearest), 300, Destination and Rate);
  • Event Player.rotationDeg = 360 - Angle Between Vectors(Vector(False, False, True), World Vector Of(Forward, Event Player,
  • Rotation));
  • If(Global.Settings[5]);
  • Create HUD Text(All Players(All Teams), Custom String("{0}",
  • Global.ColorSettings[Global.GemColors[Event Player.cursorAddrX][Event Player.cursorAddrY]][2]), Null, Null, Top, False, Color(
  • White), Null, Null, Visible To Sort Order and String, Visible Never);
  • End;
  • While(True);
  • "#control with movement keys"
  • If(Global.Settings[6]);
  • Event Player.cursor += Throttle Of(Event Player);
  • "control with facing angle"
  • Else;
  • Disable Inspector Recording;
  • Event Player.tempVect = Direction From Angles(90, Min(140, Max(40, 90 - Horizontal Facing Angle Of(Event Player)))) * Vector(True,
  • True, False) + Direction From Angles(0, Min(135, Max(45, Vertical Facing Angle Of(Event Player) + 90))) * Vector(True, False,
  • True);
  • Event Player.cursorPos = Vector(Cosine From Degrees(Event Player.rotationDeg) * Z Component Of(Event Player.tempVect)
  • - Sine From Degrees(Event Player.rotationDeg) * X Component Of(Event Player.tempVect), Y Component Of(Event Player.tempVect),
  • -1 * (Cosine From Degrees(Event Player.rotationDeg) * X Component Of(Event Player.tempVect) + Sine From Degrees(
  • Event Player.rotationDeg) * Z Component Of(Event Player.tempVect)));
  • Event Player.cursor = Ray Cast Hit Position(Vector(False, 30, False), Vector(False, 30, False) + Event Player.cursorPos * 100,
  • Null, Null, False);
  • Enable Inspector Recording;
  • End;
  • Wait(0.016, Ignore Condition);
  • End;
  • }
  • }
  • rule("New board on Reload")
  • {
  • event
  • {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • conditions
  • {
  • Is Button Held(Event Player, Button(Reload)) == True;
  • Global.IsInProcessing == False;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: new board triggered"));
  • Global.Points = Max(False, Global.Points - 250 * Global.Level);
  • If(Global.Settings[2]);
  • Set Match Time(Max(15, Match Time - 30));
  • End;
  • Global.IsReceivingPoints = False;
  • Global.IsInProcessing = True;
  • Destroy All Effects;
  • Global.GemColors = Empty Array;
  • Wait(0.250, Ignore Condition);
  • "restore cursor"
  • Create Effect(Event Player, Orb, Color(Yellow), Vector(Min(21, Max(X Component Of(Event Player.cursor), -21)), 0.500, Min(21, Max(
  • Z Component Of(Event Player.cursor), -21))), 2.500, Visible To Position and Radius);
  • Call Subroutine(GridFill);
  • Call Subroutine(ClearGrid);
  • Global.IsReceivingPoints = True;
  • Global.IsInProcessing = False;
  • }
  • }
  • rule("Remove Assembling Heroes")
  • {
  • event
  • {
  • Ongoing - Global;
  • }
  • conditions
  • {
  • (Is In Setup || Is Assembling Heroes) == True;
  • }
  • actions
  • {
  • Set Match Time(0);
  • }
  • }
  • rule("Gem selection")
  • {
  • event
  • {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • conditions
  • {
  • (Is Button Held(Event Player, Button(Primary Fire)) || Is Button Held(Event Player, Button(Secondary Fire))) == True;
  • Global.IsInProcessing == False;
  • }
  • actions
  • {
  • If(Event Player.Selection1 == Array(100, 100));
  • If(Global.GemColors[Event Player.cursorAddrX][Event Player.cursorAddrY]);
  • Event Player.Selection1 = Array(Event Player.cursorAddrX, Event Player.cursorAddrY);
  • Play Effect(Event Player, Debuff Impact Sound, Color(White), Vector(False, False, False), 100);
  • Log To Inspector(Custom String("[BJWLD]: player selected gem 1"));
  • End;
  • Else If(First Of(Event Player.Selection1)
  • == Event Player.cursorAddrX && Event Player.Selection1[True] == Event Player.cursorAddrY);
  • Log To Inspector(Custom String("[BJWLD]: player deselected gem"));
  • Event Player.Selection1 = Array(100, 100);
  • Event Player.Selection2 = Array(100, 100);
  • Else If(Global.GemColors[Event Player.cursorAddrX][Event Player.cursorAddrY]);
  • "only one of conditions should be true"
  • If((Absolute Value(Event Player.cursorAddrX - First Of(Event Player.Selection1)) == 1 && Absolute Value(
  • Event Player.cursorAddrY - Event Player.Selection1[True]) == Null) || (Absolute Value(
  • Event Player.cursorAddrY - Event Player.Selection1[True]) == 1 && Absolute Value(Event Player.cursorAddrX - First Of(
  • Event Player.Selection1)) == Null));
  • Event Player.Selection2 = Array(Event Player.cursorAddrX, Event Player.cursorAddrY);
  • Log To Inspector(Custom String("[BJWLD]: player selected gem 2"));
  • Play Effect(Event Player, Debuff Impact Sound, Color(White), Vector(False, False, False), 100);
  • Event Player.IsReset = False;
  • Call Subroutine(ReplaceGems);
  • Else;
  • Small Message(Event Player, Custom String("Improper gem"));
  • }
  • }
  • rule("Time Up")
  • {
  • event
  • {
  • Ongoing - Global;
  • }
  • conditions
  • {
  • Match Time <= 0.100;
  • }
  • actions
  • {
  • Set Match Time(35);
  • If(Global.Settings[2]);
  • Declare Team Victory(Team 2);
  • Else;
  • Declare Match Draw;
  • }
  • }
  • rule("Level up and Win conditions")
  • {
  • event
  • {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • conditions
  • {
  • Global.Points >= Global.Level * (Global.Level + True) / 2 * 500;
  • Global.IsInProcessing == False;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: level up"));
  • Global.Level += 1;
  • Play Effect(All Players(All Teams), Ring Explosion, Color(Yellow), Vector(False, 0.500, False), 50);
  • Play Effect(All Players(All Teams), Ring Explosion Sound, Color(White), Vector(False, 0.500, False), 100);
  • Big Message(All Players(All Teams), Custom String("Level Up!"));
  • If(Global.Level == 6 && !Global.Settings[3]);
  • Wait(0.250, Ignore Condition);
  • Play Effect(All Players(All Teams), Ring Explosion, Color(Red), Vector(False, 0.500, False), 50);
  • Wait(0.200, Ignore Condition);
  • Play Effect(All Players(All Teams), Ring Explosion, Color(Green), Vector(False, 0.500, False), 50);
  • Wait(0.150, Ignore Condition);
  • Play Effect(All Players(All Teams), Ring Explosion, Color(Blue), Vector(False, 0.500, False), 50);
  • Declare Team Victory(Team 1);
  • Else;
  • If(Global.Settings[2]);
  • Set Match Time(Max(30, 150 - 30 * (Global.Level - True)));
  • End;
  • Global.IsInProcessing = True;
  • Destroy All Effects;
  • Global.GemColors = Empty Array;
  • Wait(0.250, Ignore Condition);
  • "restore cursor"
  • Create Effect(Event Player, Orb, Color(Yellow), Vector(Min(21, Max(X Component Of(Event Player.cursor), -21)), 0.500, Min(21, Max(
  • Z Component Of(Event Player.cursor), -21))), 2.500, Visible To Position and Radius);
  • Call Subroutine(GridFill);
  • Call Subroutine(ClearGrid);
  • Global.IsInProcessing = False;
  • }
  • }
  • rule("[Sub]: creates gem (Inputs: Color, Row, Col)")
  • {
  • event
  • {
  • Subroutine;
  • CreateGem;
  • }
  • actions
  • {
  • Global.ArrReplaceRow = Global.Row;
  • Global.ArrReplaceCol = Global.Col;
  • Global.ArrReplaceVal = Global.Clr;
  • Call Subroutine(GemColorArrReplace);
  • Create Effect(All Players(All Teams), Sphere, Global.GemColors[Evaluate Once(Global.Row)][Evaluate Once(Global.Col)], Vector(
  • Global.Settings[1] / 2 * 4 - Global.Col * 4 - 2, 0.500, First Of(Global.Settings) / 2 * 4 - Global.Row * 4 - 2), 2,
  • Visible To and Color);
  • Create Effect(Global.GemColors[Evaluate Once(Global.Row)][Evaluate Once(Global.Col)] == -1 ? Null : All Players(All Teams), Sphere,
  • Global.GemColors[Evaluate Once(Global.Row)][Evaluate Once(Global.Col)], Vector(Global.Settings[1] / 2 * 4 - Global.Col * 4 - 2,
  • 0.500, First Of(Global.Settings) / 2 * 4 - Global.Row * 4 - 2), 2, Visible To and Color);
  • }
  • }
  • rule("[Sub]: fill grid")
  • {
  • event
  • {
  • Subroutine;
  • GridFill;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: fill grid"));
  • Global.Row = Null;
  • Global.Col = Null;
  • While(Global.Row < First Of(Global.Settings));
  • If(Global.GemColors[Global.Row] == Empty Array);
  • Global.GemColors[Global.Row] = Empty Array;
  • End;
  • While(Global.Col < Global.Settings[1]);
  • If(!Global.GemColors[Global.Row][Global.Col]);
  • Global.Clr = First Of(Global.AvailableColors[Random Integer(False, Count Of(Global.AvailableColors) - 1)]);
  • Call Subroutine(CreateGem);
  • Play Effect(All Players(All Teams), Good Pickup Effect, Color(Yellow), Vector(Global.Settings[True] / 2 * 4 - Global.Col * 4 - 2,
  • 0.500, First Of(Global.Settings) / 2 * 4 - Global.Row * 4 - 2), 2);
  • Play Effect(All Players(All Teams), Buff Explosion Sound, Color(White), Vector(False, False, False), 100);
  • Else If(Global.GemColors[Global.Row][Global.Col] == -1);
  • Global.ArrReplaceRow = Global.Row;
  • Global.ArrReplaceCol = Global.Col;
  • Global.ArrReplaceVal = First Of(Global.AvailableColors[Random Integer(False, Count Of(Global.AvailableColors) - 1)]);
  • Call Subroutine(GemColorArrReplace);
  • End;
  • Global.Col += 1;
  • End;
  • Global.Col = Null;
  • Global.Row += 1;
  • End;
  • }
  • }
  • rule("[Sub]: Arr replace (GemColor arr)")
  • {
  • event
  • {
  • Subroutine;
  • GemColorArrReplace;
  • }
  • actions
  • {
  • Global.Temp = Global.GemColors[Global.ArrReplaceRow];
  • Global.Temp[Global.ArrReplaceCol] = Global.ArrReplaceVal;
  • Global.GemColors[Global.ArrReplaceRow] = Global.Temp;
  • }
  • }
  • rule("[Sub]: gems waterfall")
  • {
  • event
  • {
  • Subroutine;
  • GemsWaterfall;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: Gems Waterfall"));
  • Global.I = Null;
  • While(Global.I < Global.Settings[1]);
  • Global.K = Null;
  • Enable Inspector Recording;
  • Global.TempRow = Empty Array;
  • While(Global.K < First Of(Global.Settings));
  • Global.TempRow[Count Of(Global.TempRow)] = Global.GemColors[Global.K][Global.I];
  • Global.K += 1;
  • End;
  • If(Global.TempRow != Sorted Array(Global.TempRow, Current Array Element == -1 ? 0 : Current Array Index + 1));
  • Global.TempRow = Sorted Array(Global.TempRow, Current Array Element == -1 ? 0 : Current Array Index + 1);
  • Global.J = Null;
  • While(Global.J < Count Of(Global.TempRow));
  • Global.ArrReplaceRow = Global.J;
  • Global.ArrReplaceCol = Global.I;
  • Global.ArrReplaceVal = -1;
  • Call Subroutine(GemColorArrReplace);
  • Global.J += 1;
  • End;
  • Wait(0.016, Ignore Condition);
  • Global.J = Null;
  • While(Global.J < Count Of(Global.TempRow));
  • Global.ArrReplaceRow = Global.J;
  • Global.ArrReplaceCol = Global.I;
  • Global.ArrReplaceVal = Global.TempRow[Global.J];
  • Call Subroutine(GemColorArrReplace);
  • Global.J += 1;
  • End;
  • End;
  • Global.I += 1;
  • End;
  • }
  • }
  • rule("[Sub]: Check row matches")
  • {
  • event
  • {
  • Subroutine;
  • CheckRowMatches;
  • }
  • actions
  • {
  • Global.I = Null;
  • While(Global.I < Count Of(Global.GemColors));
  • Global.TempRow = Empty Array;
  • Global.K = Null;
  • While(Global.K < Count Of(Global.GemColors[Global.I]));
  • Global.TempRow[Count Of(Global.TempRow)] = Array(Global.I, Global.K, Global.GemColors[Global.I][Global.K]);
  • Global.K += 1;
  • End;
  • Call Subroutine(FindMatches);
  • Global.I += 1;
  • End;
  • }
  • }
  • rule("[Sub] recieves TempRow and looks for any matches in it. Output: Matches")
  • {
  • event
  • {
  • Subroutine;
  • FindMatches;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: find matches"));
  • Global.J = Null;
  • Global.Counter = 1;
  • Global.LastColor = -1;
  • Global.CurStreak = Empty Array;
  • While(Global.J < Count Of(Global.TempRow));
  • If(Global.TempRow[Global.J][2] == Global.LastColor);
  • Global.Counter += 1;
  • Else;
  • If(Global.Counter >= 3);
  • Modify Global Variable(Matches, Append To Array, Global.CurStreak);
  • Call Subroutine(GivePoints);
  • End;
  • Global.Counter = 1;
  • Global.CurStreak = Empty Array;
  • End;
  • Global.LastColor = Global.TempRow[Global.J][2];
  • Modify Global Variable(CurStreak, Append To Array, First Of(Global.TempRow[Global.J]));
  • Modify Global Variable(CurStreak, Append To Array, Global.TempRow[Global.J][True]);
  • Global.J += 1;
  • End;
  • If(Global.Counter >= 3);
  • Modify Global Variable(Matches, Append To Array, Global.CurStreak);
  • Call Subroutine(GivePoints);
  • End;
  • Global.CurStreak = Empty Array;
  • Global.J = Null;
  • }
  • }
  • rule("[Sub]: give points")
  • {
  • event
  • {
  • Subroutine;
  • GivePoints;
  • }
  • actions
  • {
  • If(Global.IsReceivingPoints);
  • Global.Points += 10 * Global.Level * (Count Of(Global.CurStreak) / 2 - 2);
  • If(Global.Settings[2]);
  • Set Match Time(Match Time + (Count Of(Global.CurStreak) / 2 - 2));
  • End;
  • End;
  • }
  • }
  • rule("[Sub]: Check col matches")
  • {
  • event
  • {
  • Subroutine;
  • CheckColMatches;
  • }
  • actions
  • {
  • Global.I = Null;
  • While(Global.I < Global.Settings[True]);
  • Global.K = Null;
  • Global.TempRow = Empty Array;
  • While(Global.K < First Of(Global.Settings));
  • Global.TempRow[Count Of(Global.TempRow)] = Array(Global.K, Global.I, Global.GemColors[Global.K][Global.I]);
  • Global.K += 1;
  • End;
  • Call Subroutine(FindMatches);
  • Global.I += 1;
  • End;
  • }
  • }
  • rule("[Sub]: clear matches")
  • {
  • event
  • {
  • Subroutine;
  • ClearMatches;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: clear matches"));
  • Global.I = Null;
  • Global.ArrReplaceVal = -1;
  • While(Global.I < Count Of(Global.Matches));
  • Global.ArrReplaceRow = Global.Matches[Global.I];
  • Global.ArrReplaceCol = Global.Matches[Global.I + 1];
  • Play Effect(All Players(All Teams), Good Explosion, Color(Yellow), Vector(
  • Global.Settings[True] / 2 * 4 - Global.ArrReplaceCol * 4 - 2, 0.500, First Of(Global.Settings)
  • / 2 * 4 - Global.ArrReplaceRow * 4 - 2), 2);
  • Play Effect(All Players(All Teams), Buff Impact Sound, Color(White), Vector(False, False, False), 100);
  • Call Subroutine(GemColorArrReplace);
  • Global.I += 2;
  • End;
  • Global.Matches = Empty Array;
  • }
  • }
  • rule("[Sub]: Clear Grid")
  • {
  • event
  • {
  • Subroutine;
  • ClearGrid;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: clear grid"));
  • Call Subroutine(CheckRowMatches);
  • Call Subroutine(CheckColMatches);
  • If(Count Of(Global.Matches) > 0);
  • Call Subroutine(ClearMatches);
  • Wait(0.500, Ignore Condition);
  • If(Global.Settings[4]);
  • Call Subroutine(GemsWaterfall);
  • Wait(0.200, Ignore Condition);
  • End;
  • Call Subroutine(GridFill);
  • Wait(0.200, Ignore Condition);
  • Call Subroutine(ClearGrid);
  • End;
  • }
  • }
  • rule("[Sub]: Replaces 2 gems")
  • {
  • event
  • {
  • Subroutine;
  • ReplaceGems;
  • }
  • actions
  • {
  • Log To Inspector(Custom String("[BJWLD]: replace gems"));
  • Global.K = Global.GemColors[First Of(Event Player.Selection1)][Event Player.Selection1[1]];
  • Global.ArrReplaceRow = First Of(Event Player.Selection1);
  • Global.ArrReplaceCol = Event Player.Selection1[1];
  • Global.ArrReplaceVal = Global.GemColors[First Of(Event Player.Selection2)][Event Player.Selection2[1]];
  • Call Subroutine(GemColorArrReplace);
  • Global.ArrReplaceRow = First Of(Event Player.Selection2);
  • Global.ArrReplaceCol = Event Player.Selection2[1];
  • Global.ArrReplaceVal = Global.K;
  • Call Subroutine(GemColorArrReplace);
  • Wait(0.250, Ignore Condition);
  • If(!Event Player.IsReset);
  • Global.IsInProcessing = True;
  • Call Subroutine(CheckRowMatches);
  • Call Subroutine(CheckColMatches);
  • If(Count Of(Global.Matches) > 0);
  • Event Player.Selection1 = Array(100, 100);
  • Event Player.Selection2 = Array(100, 100);
  • Call Subroutine(ClearMatches);
  • Wait(0.500, Ignore Condition);
  • If(Global.Settings[4]);
  • Call Subroutine(GemsWaterfall);
  • Wait(0.200, Ignore Condition);
  • End;
  • Call Subroutine(GridFill);
  • Wait(0.200, Ignore Condition);
  • Call Subroutine(ClearGrid);
  • "Without this crash will happen (idk why)"
  • Wait(0.016, Ignore Condition);
  • Else;
  • Event Player.IsReset = True;
  • Event Player.Temp = Event Player.Selection1;
  • Event Player.Selection1 = Event Player.Selection2;
  • Event Player.Selection2 = Event Player.Temp;
  • Call Subroutine(ReplaceGems);
  • End;
  • Global.IsInProcessing = False;
  • Else;
  • Event Player.Selection1 = Array(100, 100);
  • Event Player.Selection2 = Array(100, 100);
  • End;
  • }
  • }
Join the Workshop.codes Discord