Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#CLIENTSIDE
- // The Characters Present in the Game
- function onCreated(){
- this.a = {"A","B","C","D","E","F","G","H","I","J","K",
- "L","M","N","O","P","Q","R","S","T","U","V",
- "W","X","Y","Z","1","2","3","4","5","6","7",
- "8","9","0"};
- this.td = 1;
- }
- // Activation of the Game
- function onPlayerChats(){
- if(player.chat == "/speedtyper"){
- if(!(SpeedTyper_Window.visible)){
- Open_Game();
- player.chat = "";
- }
- }
- }
- // The Start Menu
- function Open_Game(){
- Instructions_Window.hide();
- Difficulty_Window.hide();
- new GuiWindowCtrl("SpeedTyper_Window"){
- profile = GuiBlueWindowProfile;
- x = GraalControl.width / 2.35;
- y = GraalControl.height / 2.5;
- width = 200;
- height = 270;
- text = "SpeedTyper";
- canclose = false;
- canmove = true;
- destroyonhide = true;
- canresize = false;
- canmaximize = false;
- canminimize = false;
- new GuiScrollCtrl("Instructions"){
- profile = GuiBlueScrollProfile;
- x = 15;
- y = 30;
- width = 170;
- height = 130;
- hScrollBar = "alwaysOff";
- vScrollBar = "dynamic";
- new GuiMLTextCtrl("Ins_Writing"){
- profile = GuiBlueMLTextProfile;
- x = 0;
- y = 0;
- width = 165;
- height = 20;
- text = "<just:center><b><i><font size=24>SpeedTyper</font></i></b>" NL""NL "<just:center><font size=14><b>Do you think your fingers are fast enough? Start the game to find out!</b></font>" NL "" NL "<just:center><font size=14><i>Scripted By: Kavan<i></font>";
- }
- }
- new GuiButtonCtrl("Start_Button"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 165;
- width = 170;
- height = 20;
- text = "Start Game";
- }
- new GuiButtonCtrl("Instructions_Button"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 189;
- width = 170;
- height = 20;
- text = "Instructions";
- }
- new GuiButtonCtrl("Difficulty_Button"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 213;
- width = 170;
- height = 20;
- text = "Difficulty Settings";
- }
- new GuiButtonCtrl("Quit_Button"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 237;
- width = 170;
- height = 20;
- text = "Quit Game";
- }
- }
- }
- function Start_Button.onAction(){
- if(!(Game_Window.visible)){
- this.score = 0;
- Start_Game();
- }
- }
- function Instructions_Button.onAction(){
- if(!(Instructions_Window.visible)){
- Open_Instructions();
- }
- }
- function Difficulty_Button.onAction(){
- if(!(Difficulty_Window.visible)){
- Open_Difficulty();
- }
- }
- function Quit_Button.onAction(){
- SpeedTyper_Window.hide();
- }
- // The Instructions Menu
- function Open_Instructions(){
- SpeedTyper_Window.hide();
- new GuiWindowCtrl("Instructions_Window"){
- profile = GuiBlueWindowProfile;
- x = GraalControl.width / 2.35;
- y = GraalControl.height / 2.5;
- width = 200;
- height = 270;
- text = "Instructions";
- canclose = true;
- canmove = true;
- destroyonhide = true;
- canresize = false;
- canmaximize = false;
- canminimize = false;
- new GuiScrollCtrl("Border"){
- profile = GuiBlueScrollProfile;
- x = 15;
- y = 30;
- width = 170;
- height = 200;
- hScrollBar = "alwaysOff";
- vScrollBar = "dynamic";
- new GuiMLTextCtrl("Words"){
- profile = GuiBlueMLTextProfile;
- x = 0;
- y = 0;
- width = 150;
- height = 20;
- text = "<just:center><b><i><font size=24>Instructions</font></i></b>" NL""NL "<just:center><font size=14><b>-When the game starts, you must enter the symbols displayed in the box into the text box below it, inside the time limit." NL""NL "-Once you have entered it in, press Enter to confirm." NL""NL "-For each round passed, you gain 1 point." NL""NL "-If you do not enter the symbols into the text box in time, the game is over." NL "" NL "<i>~Good luck!~</i></b></font>";
- }
- }
- new GuiButtonCtrl("Back_Button"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 237;
- width = 170;
- height = 20;
- text = "Back";
- }
- }
- }
- function Back_Button.onAction(){
- if(!(SpeedTyper_Window.visible)){
- Open_Game();
- }
- }
- // The Difficulty Menu
- function Open_Difficulty(){
- SpeedTyper_Window.hide();
- new GuiWindowCtrl("Difficulty_Window"){
- profile = GuiBlueWindowProfile;
- x = GraalControl.width / 2.35;
- y = GraalControl.height / 2.5;
- width = 200;
- height = 270;
- text = "Difficulty";
- canclose = false;
- canmove = true;
- destroyonhide = true;
- canresize = false;
- canmaximize = false;
- canminimize = false;
- new GuiScrollCtrl("Diff_Encase"){
- profile = GuiBlueScrollProfile;
- x = 15;
- y = 30;
- width = 170;
- height = 100;
- hScrollBar = "alwaysOff";
- vScrollBar = "dynamic";
- new GuiMLTextCtrl("Diff_Teller"){
- profile = GuiBlueMLTextProfile;
- x = 0;
- y = 0;
- width = 150;
- height = 20;
- text = "<just:center><font size=24><b><i>Difficulty</i></b></font>" NL""NL "<just:center><font size=14><b>Difficulty: Easy</b></font>";
- }
- new GuiMLTextCtrl("Diff_Description"){
- profile = GuiBlueMLTextProfile;
- x = 0;
- y = 65;
- width = 150;
- height = 20;
- text = "<just:center><font size=14><i>For those who are uncomfortable with the keyboard layout.</i></font>";
- }
- }
- new GuiButtonCtrl("Easy"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 135;
- width = 170;
- height = 20;
- text = "Easy";
- }
- new GuiButtonCtrl("Regular"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 159;
- width = 170;
- height = 20;
- text = "Regular";
- }
- new GuiButtonCtrl("Hard"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 183;
- width = 170;
- height = 20;
- text = "Hard";
- }
- new GuiButtonCtrl("Extreme"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 207;
- width = 170;
- height = 20;
- text = "Extreme";
- }
- new GuiButtonCtrl("Return_Button"){
- profile = GuiBlueButtonProfile;
- x = 15;
- y = 237;
- width = 170;
- height = 20;
- text = "Back";
- }
- }
- Assign();
- }
- // Assigned on Opening
- function Assign(){
- if(this.td == 2){
- Easy();
- }
- if(this.td == 1){
- Regular();
- }
- if(this.td == 0.5){
- Hard();
- }
- if(this.td == 0.3){
- Extreme();
- }
- }
- // Assignments on Buttons Pressed
- function Easy.onAction(){
- this.td = 2;
- Easy();
- }
- function Regular.onAction(){
- this.td = 1;
- Regular();
- }
- function Hard.onAction(){
- this.td = 0.5;
- Hard();
- }
- function Extreme.onAction(){
- this.td = 0.3;
- Extreme();
- }
- // Descriptions
- function Easy(){
- Diff_Teller.settext("<just:center><font size=24><b><i>Difficulty</i></b></font>" NL""NL "<just:center><font size=14><b>Difficulty: Easy</b></font>");
- Diff_Description.settext("<just:center><font size=14><i>For those who are uncomfortable with the keyboard layout.</i></font>");
- }
- function Regular(){
- Diff_Teller.settext("<just:center><font size=24><b><i>Difficulty</i></b></font>" NL""NL "<just:center><font size=14><b>Difficulty: Regular</b></font>");
- Diff_Description.settext("<just:center><font size=14><i>For those who know the keyboard layout fairly well and can type fluently.</i></font>");
- }
- function Hard(){
- Diff_Teller.settext("<just:center><font size=24><b><i>Difficulty</i></b></font>" NL""NL "<just:center><font size=14><b>Difficulty: Hard</b></font>");
- Diff_Description.settext("<just:center><font size=14><i>For those who want a typing challenge and arthritic fingers by the end of it.</i></font>");
- }
- function Extreme(){
- Diff_Teller.settext("<just:center><font size=24><b><i>Difficulty</i></b></font>" NL""NL "<just:center><font size=14><b>Difficulty: Extreme</b></font>");
- Diff_Description.settext("<just:center><font size=14><i>Your fingers will not survive this typing challenge on this difficulty.</i></font>");
- }
- function Return_Button.onAction(){
- if(!(SpeedTyper_Window.visible)){
- Open_Game();
- }
- }
- // The Game Menu
- function Start_Game(){
- SpeedTyper_Window.hide();
- this.countdown = 3;
- new GuiWindowCtrl("Game_Window"){
- profile = GuiBlueWindowProfile;
- x = GraalControl.width / 2.45;
- y = GraalControl.height / 2.5;
- width = 250;
- height = 225;
- text = "SpeedTyper";
- canclose = true;
- destroyonhide = true;
- canmove = true;
- canresize = false;
- canmaximize = false;
- canminimize = false;
- new GuiTextCtrl("Time_Teller"){
- profile = GuiBlueTextProfile;
- x = 16;
- y = 25;
- text = "Time Left:";
- }
- new GuiProgressCtrl("Time_Bar"){
- profile = GuiBlueProgressProfile;
- x = 15;
- y = 45;
- width = 220;
- height = 30;
- }
- new GuiTextCtrl("Symbols_Chosen"){
- profile = GuiBlueTextProfile;
- x = 16;
- y = 80;
- text = "Symbols Chosen:";
- }
- new GuiScrollCtrl("Words_Encasing"){
- profile = GuiBlueScrollProfile;
- x = 15;
- y = 100;
- width = 220;
- height = 70;
- hScrollBar = "alwaysOff";
- vScrollBar = "dynamic";
- new GuiMLTextCtrl("Symbols"){
- profile = GuiBlueMLTextProfile;
- x = 0;
- y = 22;
- width = 210;
- height = 30;
- }
- }
- new GuiTextCtrl("Your_Symbols"){
- profile = GuiBlueTextProfile;
- x = 16;
- y = 171;
- text = "Type symbols here:";
- }
- new GuiTextEditCtrl("Enter_Symbols"){
- profile = GuiBlueTextEditProfile;
- x = 15;
- y = 190;
- width = 220;
- height = 20;
- }
- }
- sleep(1);
- Start_CountDown();
- }
- // The Functions of the Game
- function Start_CountDown(){
- Enter_Symbols.text = "";
- Time_Bar.progress = 1;
- Symbols.settext("<just:center><font size=20><b>Starting in: 3</b></font>");
- sleep(1);
- Symbols.settext("<just:center><font size=20><b>Starting in: 2</b></font>");
- sleep(1);
- Symbols.settext("<just:center><font size=20><b>Starting in: 1</b></font>");
- sleep(1);
- Symbols.settext("<just:center><font size=20><b>Starting!...</b></font>");
- sleep(1);
- Set_Symbols();
- }
- function Set_Symbols(){
- this.tmode = 1;
- this.t = 1;
- setTimer(".05");
- Symbols.settext("<just:center><font size=20><b>"@this.a[int(random(0,37))]@this.a[int(random(0,37))]@this.a[int(random(0,37))]@this.a[int(random(0,37))]@this.a[int(random(0,37))]@this.a[int(random(0,37))]@this.a[int(random(0,37))]@this.a[int(random(0,37))]@this.a[int(random(0,37))]@this.a[int(random(0,37))]@"</b></font>");
- this.sym = Symbols.text;
- }
- function Confirm_Answer.onAction(){
- Reset();
- }
- function Enter_Symbols.onAction(){
- Reset();
- }
- function Reset(){
- if(this.tmode == 1){
- this.ans = "<just:center><font size=20><b>"@Enter_Symbols.text@"</b></font>";
- if(this.ans.upper() == this.sym){
- if(this.td == 2){
- this.score ++;
- }
- if(this.td == 1){
- this.score += 2;
- }
- if(this.td == 0.5){
- this.score += 3;
- }
- if(this.td == 0.3){
- this.score += 4;
- }
- this.tmode = 0;
- Symbols.text = "<just:center><font size=20><b>Correct!</b></font>";
- sleep(2);
- Symbols.settext("<just:center><font size=20><b>Score: "@this.score@"</b></font>");
- sleep(2);
- Start_CountDown();
- }
- else {
- this.tmode = 2;
- Symbols.settext("<just:center><font size=20><b>Incorrect!</b></font>");
- sleep(1);
- setTimer("0.05");
- Symbols.settext(this.sym);
- this.tmode = 1;
- }
- }
- }
- // Time Control
- function onTimeout(){
- if(this.tmode == 1){
- if(this.t != 0){
- Time_Bar.progress = this.t;
- this.t -= 0.05;
- }
- else {
- this.tmode = 2;
- Symbols.settext("<just:center><font size=20><b>Game Over!</b></font>");
- Confirm_Answer.hide();
- sleep(2);
- Symbols.settext("<just:center><font size=20><b>Final Score: "@this.score@"</b></font>");
- sleep(2);
- Game_Window.hide();
- }
- }
- setTimer(this.td);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement