Results 1 to 7 of 7
  1. #1
    Muchacho_Man's Avatar
    Join Date
    Jul 2014
    Gender
    male
    Location
    You do not need to know that c:
    Posts
    104
    Reputation
    56
    Thanks
    39
    My Mood
    Amazed

    [Realm Relay] CemCount.js - Script


    Hello, MPGH
    I have created the ultimate cemetery script.
    I am new to scripting, so this is my first script. I want to simply share my ideas. It is a pretty small script but I hope its useful even at the slightest.

    What does it do?
    This script counts the waves ( so you don't have to ), counts down the 3 seconds, and also says 'ready' automatically

    Code:
    // cemcount.js
    // made by muchacho
    
    $.echo('Cemcount.js loaded');
    
    var ID_TEXT = $.findPacketId("TEXT");
    var ID_CREATE_SUCCESS = $.findPacketId("CREATE_SUCCESS");
    var ID_NOTIFICATION = $.findPacketId("NOTIFICATION");
    var ID_PLAYERTEXT = $.findPacketId("PLAYERTEXT");
    
    var wave = 0;
    
    function onServerPacket(event) {
    
    	var packet = event.getPacket();
    	
    	switch (packet.id()) {
    	
    		case ID_CREATE_SUCCESS: {
    		
    			playerObjectId = packet.objectId;
    			break;
    			
    		}
    		
    		case ID_TEXT: {
    			
    			var text = packet.text;
    			var filteredText = packet.text.toLowerCase();
    			var star = packet.numStars;
    			
    			if (filteredText.indexOf('say') >= 0 && filteredText.indexOf('ready') >= 0 && star === -1) { // If a mob tells you to say ready
    				wave = 1; // Set to wave 1
    				playerSay(event, 'ready'); // Say ready
    				displayWave(event, wave);
    			} else if (filteredText.indexOf('3') >= 0 && filteredText.indexOf('seconds') >= 0 && star === -1) { // If a mob says 3 seconds till next wave
    				wave += 1; // Increment the wave by 1
    				cemCountDown(event); // Count down / display wave
    			} else if (filteredText.indexOf('congratulations') >= 0 && filteredText.indexOf('warrior') >= 0 && star === -1) { // Ghost of skuld final boss
    				displayCemNotification(event, playerObjectId, 0xFF0000, "Final Boss - Good Luck!"); // Wishing you good luck
    			}
    			
    		} 
    	}
    }
    
    function displayCemNotification(event, playerObjectId, color, text) {
    	var notificationPacket = event.createPacket(ID_NOTIFICATION);
    	notificationPacket.objectId = playerObjectId;
    	notificationPacket.message = "{\"key\":\"blank\",\"tokens\":{\"data\":\"" + text + "\"}}";
    	notificationPacke*****lor = color;
    	event.sendToClient(notificationPacket);
    }
    
    function displayWave(event, wave) {
    	var waveText = 'Wave ';
    	var finalWaveText = waveTex*****ncat(wave.toString());
    	var colorList = [0x009933, 0xCCFF33, 0xFFFF66, 0xFF9900, 0xFF0000];
    	var colorChoice = colorList[wave - 1];
    	
    	displayCemNotification(event, playerObjectId, colorChoice, finalWaveText); 
    }
    
    function playerSay(event, phrase) {
    	var playerSayPacket = event.createPacket(ID_PLAYERTEXT);
    	playerSayPacket.text = phrase;
    	event.sendToServer(playerSayPacket);
    }
    
    function cemCountDown(event) {
    	var sec = ["3","2","1"];
    	var sec2 = 1;
    	var colors = [0x008000, 0xFFFF00, 0xFF0000];
    	
    	displayWave(event, wave);
    	
       for (var i = 0; i < sec.length; i++) {
    	  $.scheduleEvent(sec2, "displayCemNotification", playerObjectId, colors[i], sec[i]);
    	  sec2 += 1;
       }
    }


    Current Issues
    • When you enter a cemetery late, it won't recognize which wave you're on so it will start from 1. Therefore, the wave counting will be inaccurate.


    Edit: Tweaked the script a little, the wave counter now has dynamic colour.


    https://virusscan.jotti.org/en/scanre...0dbb6877646507
    https://www.virustotal.com/en/file/3...is/1408478928/
    <b>Downloadable Files</b> Downloadable Files
    Last edited by Muchacho_Man; 08-19-2014 at 11:38 PM.

  2. The Following 6 Users Say Thank You to Muchacho_Man For This Useful Post:

    gamer788 (02-15-2015),hackerdude2 (03-05-2017),jone112233 (05-21-2015),LCraft303 (01-10-2015),marceliino (08-19-2014),VoltrecNew (04-27-2015)

  3. #2
    Lovroman's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    9,417
    Reputation
    611
    Thanks
    11,990
    My Mood
    Cheerful
    //Approved

  4. The Following User Says Thank You to Lovroman For This Useful Post:

    Muchacho_Man (08-19-2014)

  5. #3
    The richest man is not the one who has the most but the one who needs the least.
    MPGH Member
    Alde.'s Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    1,706
    Reputation
    166
    Thanks
    3,627
    My Mood
    Sleepy
    Well I already did the "ready" thing but eh, pretty nice job.
    Alde is Alde is

  6. #4
    Muchacho_Man's Avatar
    Join Date
    Jul 2014
    Gender
    male
    Location
    You do not need to know that c:
    Posts
    104
    Reputation
    56
    Thanks
    39
    My Mood
    Amazed
    Quote Originally Posted by ZBORNOX View Post
    Well I already did the "ready" thing but eh, pretty nice job.
    I know, but it's my first script, I like to learn and this is only my first creation. Thanks, though.

  7. The Following 2 Users Say Thank You to Muchacho_Man For This Useful Post:

    Alde. (08-22-2014),LCraft303 (01-10-2015)

  8. #5
    Warlordos's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Location
    Austria
    Posts
    281
    Reputation
    10
    Thanks
    14
    Nice Script i would try but im not playing prod anymore :P

  9. The Following User Says Thank You to Warlordos For This Useful Post:

    Muchacho_Man (08-20-2014)

  10. #6
    whatamidoingwithmylife2's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0
    My Mood
    Cool
    can someone explain to me how i use this? sorry for being such a noob lmao

  11. #7
    Limit67's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    139
    Reputation
    10
    Thanks
    9
    Is there a way to add this to K relay?

Similar Threads

  1. [Help Request] Realm Relay Scripts
    By asdf6969 in forum Realm of the Mad God Help & Requests
    Replies: 3
    Last Post: 11-30-2013, 09:55 AM
  2. [Help Request] Realm Relay Command Script
    By apemanzilla in forum Realm of the Mad God Help & Requests
    Replies: 2
    Last Post: 10-31-2013, 01:42 PM
  3. OUTDATED - [Realm Relay] Event Notifier script
    By IziLife in forum Realm of the Mad God Tutorials & Source Code
    Replies: 20
    Last Post: 10-28-2013, 02:11 PM
  4. [Release] Realm Relay Command Script!
    By angelofsilence123 in forum Realm of the Mad God Hacks & Cheats
    Replies: 7
    Last Post: 10-21-2013, 02:06 AM
  5. [Help Request] Realm Relay - Reconnect Script
    By Tignite in forum Realm of the Mad God Help & Requests
    Replies: 3
    Last Post: 10-16-2013, 08:05 AM