Create
Return to post

Comparing difference between and

View raw
  • settings
  • {
  • main
  • {
  • Description: "Keyboard by CaptCaptain#11421"
  • }
  • lobby
  • {
  • Map Rotation: After A Game
  • Return To Lobby: Never
  • }
  • modes
  • {
  • Assault
  • {
  • Limit Roles: 2 Of Each Role Per Team
  • }
  • Control
  • {
  • Limit Roles: 2 Of Each Role Per Team
  • }
  • Escort
  • {
  • Limit Roles: 2 Of Each Role Per Team
  • }
  • Hybrid
  • {
  • Limit Roles: 2 Of Each Role Per Team
  • }
  • }
  • }
  • variables {
  • global:
  • 0: keyboardPosition
  • 0: keyboardPositions
  • 1: keyboardIndex
  • 2: keyboardKeys
  • player:
  • 0: keyboardPosition
  • 0: keyboardPositions
  • 1: keyboardEnabled
  • 2: keyboardInput
  • 3: keyboardKey
  • 4: keyboardEntities
  • 5: keyboardIndex
  • 6: keyboardPosition
  • }
  • subroutines {
  • 0: createKeyboard
  • 1: destroyKeyboard
  • 2: sendInput
  • }
  • rule ("Initialize global variables") {
  • event {
  • Ongoing - Global;
  • }
  • actions {
  • Set Global Variable(keyboardPosition, Array(Vector(0.439, 0.396, 0.807), Vector(0.382, 0.396, 0.835), Vector(0.32, 0.396, 0.861), Vector(0.25, 0.396, 0.884), Vector(0.178, 0.399, 0.899), Vector(0.1, 0.398, 0.912), Vector(0.022, 0.397, 0.918), Vector(-0.056, 0.395, 0.917), Vector(-0.135, 0.396, 0.908), Vector(-0.21, 0.392, 0.896), Vector(-0.282, 0.393, 0.875), Vector(-0.349, 0.389, 0.852), Vector(-0.412, 0.391, 0.823), Vector(0.472, 0.29, 0.833), Vector(0.411, 0.294, 0.863), Vector(0.345, 0.289, 0.893), Vector(0.272, 0.293, 0.916), Vector(0.191, 0.295, 0.936), Vector(0.108, 0.294, 0.95), Vector(0.023, 0.292, 0.956), Vector(-0.061, 0.294, 0.954), Vector(-0.146, 0.294, 0.944), Vector(-0.227, 0.291, 0.929), Vector(-0.325, 0.295, 0.898), Vector(-0.39, 0.296, 0.872), Vector(-0.468, 0.295, 0.833), Vector(0.478, 0.191, 0.858), Vector(0.41, 0.195, 0.891), Vector(0.338, 0.194, 0.921), Vector(0.262, 0.195, 0.945), Vector(0.176, 0.193, 0.965), Vector(0.089, 0.195, 0.977), Vector(-0.004, 0.194, 0.981), Vector(-0.089, 0.191, 0.978), Vector(-0.176, 0.196, 0.965), Vector(-0.286, 0.192, 0.939), Vector(-0.36, 0.192, 0.913), Vector(-0.483, 0.19, 0.855), Vector(0.489, 0.084, 0.868), Vector(0.423, 0.083, 0.903), Vector(0.348, 0.084, 0.934), Vector(0.271, 0.085, 0.959), Vector(0.185, 0.085, 0.979), Vector(0.094, 0.086, 0.992), Vector(0.001, 0.085, 0.996), Vector(-0.085, 0.06, 0.995), Vector(-0.178, 0.061, 0.982), Vector(-0.292, 0.086, 0.953), Vector(0.27, -0.02, 0.963), Vector(0.209, -0.017, 0.978), Vector(0.12, -0.016, 0.993), Vector(0.052, -0.018, 0.998)));
  • Set Global Variable(keyboardPositions, Array(Vector(0.439, 0.396, 0.807), Vector(0.382, 0.396, 0.835), Vector(0.32, 0.396, 0.861), Vector(0.25, 0.396, 0.884), Vector(0.178, 0.399, 0.899), Vector(0.1, 0.398, 0.912), Vector(0.022, 0.397, 0.918), Vector(-0.056, 0.395, 0.917), Vector(-0.135, 0.396, 0.908), Vector(-0.21, 0.392, 0.896), Vector(-0.282, 0.393, 0.875), Vector(-0.349, 0.389, 0.852), Vector(-0.412, 0.391, 0.823), Vector(0.472, 0.29, 0.833), Vector(0.411, 0.294, 0.863), Vector(0.345, 0.289, 0.893), Vector(0.272, 0.293, 0.916), Vector(0.191, 0.295, 0.936), Vector(0.108, 0.294, 0.95), Vector(0.023, 0.292, 0.956), Vector(-0.061, 0.294, 0.954), Vector(-0.146, 0.294, 0.944), Vector(-0.227, 0.291, 0.929), Vector(-0.325, 0.295, 0.898), Vector(-0.39, 0.296, 0.872), Vector(-0.468, 0.295, 0.833), Vector(0.478, 0.191, 0.858), Vector(0.41, 0.195, 0.891), Vector(0.338, 0.194, 0.921), Vector(0.262, 0.195, 0.945), Vector(0.176, 0.193, 0.965), Vector(0.089, 0.195, 0.977), Vector(-0.004, 0.194, 0.981), Vector(-0.089, 0.191, 0.978), Vector(-0.176, 0.196, 0.965), Vector(-0.286, 0.192, 0.939), Vector(-0.36, 0.192, 0.913), Vector(-0.483, 0.19, 0.855), Vector(0.489, 0.084, 0.868), Vector(0.423, 0.083, 0.903), Vector(0.348, 0.084, 0.934), Vector(0.271, 0.085, 0.959), Vector(0.185, 0.085, 0.979), Vector(0.094, 0.086, 0.992), Vector(0.001, 0.085, 0.996), Vector(-0.085, 0.06, 0.995), Vector(-0.178, 0.061, 0.982), Vector(-0.292, 0.086, 0.953), Vector(0.27, -0.02, 0.963), Vector(0.209, -0.017, 0.978), Vector(0.12, -0.016, 0.993), Vector(0.052, -0.018, 0.998)));
  • Set Global Variable(keyboardKeys, Array(Custom String("1234567890-=←qwertyuiop[]!asdfghjkl;'┘zxcvbnm,.? ", Null, Null, Null)));
  • }
  • }
  • rule ("Initialize player variables") {
  • event {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • actions {
  • Set Player Variable(Event Player, keyboardPosition, Empty Array);
  • Set Player Variable(Event Player, keyboardPositions, Empty Array);
  • Set Player Variable(Event Player, keyboardEnabled, False);
  • Set Player Variable(Event Player, keyboardInput, Custom String("", Null, Null, Null));
  • Set Player Variable(Event Player, keyboardKey, Custom String("", Null, Null, Null));
  • Set Player Variable(Event Player, keyboardEntities, Empty Array);
  • Set Player Variable(Event Player, keyboardPosition, Empty Array);
  • }
  • }
  • rule ("Subroutine createKeyboard") {
  • event {
  • Subroutine;
  • createKeyboard;
  • }
  • actions {
  • "Align keybaord positions to the front of the player"
  • Set Player Variable(Event Player, keyboardPosition, Mapped Array(Global.keyboardPosition, First Of(World Vector Of(Current Array Element, Event Player, Rotation))));
  • "Create keyboard input"
  • Create In-World Text(All Players(All Teams), (Event Player).keyboardInput, Evaluate Once(World Vector Of(Add(Local Vector Of(Eye Position(Event Player), Event Player, Rotation And Translation), Vector(0, 0.45, 1)), Event Player, Rotation And Translation)), 30, Do Not Clip, Visible To Position and String, Color(White), Default Visibility);
  • Modify Player Variable(Event Player, keyboardEntities, Append To Array, Last Text ID);
  • "Create keyboard layout"
  • Create In-World Text(All Players(All Teams), Custom String("1234567890-=←\nQWERTYUIOP[ ]!\n ASDFGHJKL;' ┘\n ZXCVBNM,.?  \n   [__]", Null, Null, Null), Evaluate Once(World Vector Of(Add(Local Vector Of(Eye Position(Event Player), Event Player, Rotation And Translation), Vector(0, 0, 1)), Event Player, Rotation And Translation)), 30, Do Not Clip, Visible To Position and String, Color(White), Default Visibility);
  • Modify Player Variable(Event Player, keyboardEntities, Append To Array, Last Text ID);
  • Set Player Variable(Event Player, keyboardPositions, Mapped Array(Global.keyboardPositions, First Of(World Vector Of(Current Array Element, Event Player, Rotation))));
  • "Set keyboard position"
  • Set Player Variable At Index(Event Player, keyboardPosition, 0, Evaluate Once(World Vector Of(Add(Local Vector Of(Eye Position(Event Player), Event Player, Rotation And Translation), Vector(0, 0.45, 1)), Event Player, Rotation And Translation)));
  • Set Player Variable At Index(Event Player, keyboardPosition, 1, Evaluate Once(World Vector Of(Add(Local Vector Of(Eye Position(Event Player), Event Player, Rotation And Translation), Vector(0, 0, 1)), Event Player, Rotation And Translation)));
  • }
  • }
  • rule ("Subroutine destroyKeyboard") {
  • event {
  • Subroutine;
  • destroyKeyboard;
  • }
  • actions {
  • "Destroy every in world text"
  • For Player Variable(Event Player, keyboardIndex, 0, Count Of((Event Player).keyboardEntities), 1);
  • Destroy In-World Text(Value In Array((Event Player).keyboardEntities, (Event Player).keyboardIndex));
  • End;
  • Set Player Variable(Event Player, keyboardPosition, Empty Array);
  • Set Player Variable(Event Player, keyboardPositions, Empty Array);
  • Set Player Variable(Event Player, keyboardInput, Custom String("", Null, Null, Null));
  • Set Player Variable(Event Player, keyboardEntities, Empty Array);
  • Set Player Variable(Event Player, keyboardPosition, Null);
  • }
  • }
  • rule ("Render Keyboard") {
  • event {
  • Ongoing - Global;
  • }
  • actions {
  • "Create keyboard input"
  • Create In-World Text(If-Then-Else((Local Player).keyboardPosition, Local Player, Null), (Local Player).keyboardInput, First Of((Local Player).keyboardPosition), 30, Do Not Clip, Visible To Position and String, Color(White), Default Visibility);
  • "Create keyboard layout"
  • Create In-World Text(If-Then-Else((Local Player).keyboardPosition, Local Player, Null), Custom String("1234567890-=←\nQWERTYUIOP[ ]!\n ASDFGHJKL;' ┘\n ZXCVBNM,.?  \n   [__]", Null, Null, Null), Value In Array((Local Player).keyboardPosition, 1), 30, Do Not Clip, Visible To Position and String, Color(White), Default Visibility);
  • }
  • }
  • rule ("Hud") {
  • event {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • actions {
  • "Instruction hud"
  • Create HUD Text(Event Player, Custom String("Press {0} to toggle keyboard", Input Binding String(Button(Interact)), Null, Null), Null, Null, Top, 1, Color(Turquoise), Null, Null, Visible To Sort Order and String, Default Visibility);
  • }
  • }
  • rule ("Toggle Keyboard") {
  • event {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • conditions {
  • Is Button Held(Event Player, Button(Interact)) == True;
  • }
  • actions {
  • "Toggle variable"
  • Set Player Variable(Event Player, keyboardEnabled, Not((Event Player).keyboardEnabled));
  • "Run behavior"
  • If(True);
  • Skip(Value In Array(Array(4, 0), Add(1, Index Of Array Value(Array(True), (Event Player).keyboardEnabled))));
  • //__label_switch_2_0__:
  • Set Status(Event Player, Null, Rooted, 9999);
  • Set Primary Fire Enabled(Event Player, False);
  • Call Subroutine(createKeyboard);
  • Else;
  • //__label_switch_2_default__:
  • Call Subroutine(destroyKeyboard);
  • Clear Status(Event Player, Rooted);
  • Set Primary Fire Enabled(Event Player, True);
  • Else;
  • End;
  • }
  • }
  • rule ("Detect Input") {
  • event {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • conditions {
  • Is Button Held(Event Player, Button(Primary Fire)) == True;
  • }
  • actions {
  • "Check if the player is aiming toward a key"
  • If(Is True For Any((Event Player).keyboardPosition, Compare(Distance Between(Add(Eye Position(Event Player), Facing Direction Of(Event Player)), Add(Eye Position(Event Player), Current Array Element)), <=, 0.05)));
  • If(Is True For Any((Event Player).keyboardPositions, Compare(Distance Between(Add(Eye Position(Event Player), Facing Direction Of(Event Player)), Add(Eye Position(Event Player), Current Array Element)), <=, 0.05)));
  • "Get the key the player is aiming at"
  • Set Player Variable(Event Player, keyboardKey, String Slice(Global.keyboardKeys, Index Of Array Value((Event Player).keyboardPosition, Filtered Array((Event Player).keyboardPosition, Compare(Distance Between(Add(Eye Position(Event Player), Facing Direction Of(Event Player)), Add(Eye Position(Event Player), Current Array Element)), <=, 0.05))), 1));
  • Set Player Variable(Event Player, keyboardKey, String Slice(Global.keyboardKeys, Index Of Array Value((Event Player).keyboardPositions, Filtered Array((Event Player).keyboardPositions, Compare(Distance Between(Add(Eye Position(Event Player), Facing Direction Of(Event Player)), Add(Eye Position(Event Player), Current Array Element)), <=, 0.05))), 1));
  • If(True);
  • Skip(Value In Array(Array(6, 0, 4), Add(1, Index Of Array Value(Array(Custom String("┘", Null, Null, Null), Custom String("←", Null, Null, Null)), (Event Player).keyboardKey))));
  • //__label_switch_3_0__:
  • Big Message(Event Player, Custom String("{0} says '{1}'", Event Player, (Event Player).keyboardInput, Null));
  • Wait(0.25, Ignore Condition);
  • Set Player Variable(Event Player, keyboardInput, Custom String("", Null, Null, Null));
  • Else;
  • //__label_switch_3_1__:
  • Set Player Variable(Event Player, keyboardInput, String Slice((Event Player).keyboardInput, 0, Subtract(String Length((Event Player).keyboardInput), 1)));
  • Else;
  • //__label_switch_3_default__:
  • Set Player Variable(Event Player, keyboardInput, Custom String("{0}{1}", (Event Player).keyboardInput, (Event Player).keyboardKey, Null));
  • Else;
  • End;
  • Play Effect(Event Player, Buff Explosion Sound, Color(White), Event Player, 100);
  • }
  • }
  • disabled rule ("Set Keys") {
  • event {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • conditions {
  • Is Button Held(Event Player, Button(Primary Fire)) == True;
  • }
  • actions {
  • Create Effect(All Players(All Teams), Sphere, If-Then-Else(Compare(Distance Between(Add(Eye Position(Event Player), Facing Direction Of(Event Player)), Evaluate Once(Add(Eye Position(Event Player), Facing Direction Of(Event Player)))), <=, 0.05), 0, Color(White)), Evaluate Once(Add(Eye Position(Event Player), Facing Direction Of(Event Player))), 0.05, Visible To Position Radius and Color);
  • Modify Global Variable(keyboardPosition, Append To Array, Facing Direction Of(Event Player));
  • Modify Global Variable(keyboardPositions, Append To Array, Facing Direction Of(Event Player));
  • }
  • }
  • disabled rule ("Create Effects") {
  • event {
  • Ongoing - Each Player;
  • All;
  • All;
  • }
  • actions {
  • For Global Variable(keyboardIndex, 0, Count Of(Global.keyboardPosition), 1);
  • Create Effect(All Players(All Teams), Sphere, Color(White), Add(Eye Position(Event Player), World Vector Of(Value In Array(Global.keyboardPosition, Evaluate Once(Global.keyboardIndex)), Event Player, Rotation)), 0.05, Visible To Position Radius and Color);
  • For Global Variable(keyboardIndex, 0, Count Of(Global.keyboardPositions), 1);
  • Create Effect(All Players(All Teams), Sphere, Color(White), Add(Eye Position(Event Player), World Vector Of(Value In Array(Global.keyboardPositions, Evaluate Once(Global.keyboardIndex)), Event Player, Rotation)), 0.05, Visible To Position Radius and Color);
  • End;
  • }
  • }
Join the Workshop.codes Discord