Mys 1.3.4 Word Scramble Game

Forum
Last Post
Threads / Messages

Hwona

Member
Member
Joined
Mar 1, 2013
Messages
620
Points
0
Mysidian Dollar
31,589
This word scramble game is a modification of Kyttias's HiLo game! ~courtesy of Kyttias

Word Scramble Game
Word%20Scramble%20Preview_zpswnetlzoj.png

Demo: JSBin Preview
Download: Compressed Folder
View game at yoursite.com/wordscramble

Please upload these files:

games/.htaccess
games/wordscramble/sendscore.php
games/wordscramble/wordscramble.php
games/wordscramble/wordscramble.css
games/wordscramble/wordscramble.js
wordscramble.php
classes/class_cookies.php (replace the original file)
view/wordscramble.php

Create this table if you haven't:

phpMyAdmin->SQL->paste
Code:
CREATE TABLE IF NOT EXISTS `adopts_games` (
  `gid` int(11) NOT NULL AUTO_INCREMENT,
  `game` varchar(30) NOT NULL,
  `username` varchar(30) NOT NULL,
  `plays` int(11) NOT NULL,
  `timestamp` int(11) NOT NULL,
  PRIMARY KEY (`gid`),
  UNIQUE KEY `key` (`gid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;

Modifying Game Code (Advised):
The script runs games/wordscramble/wordscramble.js not games/wordscramble/wordscramble_non.js. wordscramble.js is obfuscated for security: Re-obfuscate Edited Files Here.

This game uses three filler words to unscramble! Don't forget to add more! To do so, edit the arrays at lines 8 and 40 in wordscramble_non.js. Then, obfuscate the code and paste it into wordscramble.js.
 
Last edited:
Er, ok, something's definitely not right. As soon as I submit the answer it tells me game over, see you tomorrow, and says I have 0 plays left for today (though I've only played once), and then if I refresh the page it resets and says
"Plays Left Today: of 20"

Not updated my currency amount at all, though I guarantee I am getting the answers correct. The only thing I changed in the files would be the words available to unscramble.

It's also not updating at all anywhere in the database, despite me now having attempted to play 4 times.

Even with the 100% original files it's still having this error.
 
Last edited:
*bangs head on table*
I forgot one more thing... I recently posted a code replacement for the class cookies file in the hilo thread. Please replace your original file with that? Sorry, Ill do a proper thread update when I have access to my computer.
 
Oh dear, I tried that and it resulted in this;
Catchable fatal error: Argument 2 passed to Registry::set() must implement interface Resource\Native\Objective, instance of Cookies given, called in /home/catisserie/public_html/classes/class_mysidia.php on line 237 and defined in /home/catisserie/public_html/classes/class_registry.php on line 198
 
Oh dear, I tried that and it resulted in this;
Catchable fatal error: Argument 2 passed to Registry::set() must implement interface Resource\Native\Objective, instance of Cookies given, called in /home/catisserie/public_html/classes/class_mysidia.php on line 237 and defined in /home/catisserie/public_html/classes/class_registry.php on line 198

Yikes! I guess mys.1.3.4 class files are different too! Try this:
PHP:
<?php

/**
 * The Cookies Class, it is one of Mysidia system core classes.
 * It acts as an initializer and wrapper for Mys-related cookies.
 * Cookies is a final class, no child class shall derive from it.
 * An instance of Cookies class is generated upon Mysidia system object's creation. 
 * This specific instance is available from Registry, just like any other Mysidia core objects. 
 * @category Resource
 * @package Core
 * @author Hall of Famer 
 * @copyright Mysidia Adoptables Script
 * @link http://www.mysidiaadoptables.com
 * @since 1.3.2
 * @todo better naming of cookies methods.
 */

final class Cookies extends Core{

    /**
	 * The mysuid property, which stores the id of the current user. 
	 * For guest, this id is 0.	 
	 * @access private
	 * @var Int
    */
    private $mysuid;
	
	private $mysusername;
  
    /**
	 * The myssession property, which stores the session var of the current user. 
	 * @access private
	 * @var String
    */
    private $myssession;
   
    /**
	 * The mysactivity property, which stores the timestamp for the current user's last activity. 
	 * @access private
	 * @var Int
    */
    private $mysactivity;
  
    /**
	 * The mysloginattempt property, which stores how many failed login attempt made by this particular user.
	 * @access private
	 * @var Int
    */
    private $mysloginattempt;

	
    /**
     * Constructor of Cookies Class, it loads mys-related cookie vars from $_COOKIE superglobals.    
     * @access public
     * @return Void
     */	 
    public function __construct(){
        $keyarray = array("mysuid", "mysusername", "myssession", "mysactivity", "mysloginattempt");
        foreach($_COOKIE as $key => $val){
	        if(in_array($key, $keyarray)) $this->$key = $val;
	    }	
    }
	
	/**
     * The get method, which retrieves private cookie item from Cookies object.  
	 * If supplied argument is invalid, an exception will be thrown.
	 * @param String  $prop
     * @access public
     * @return Boolean
     */	
    public function getcookies($prop){
        if(!property_exists('Cookies', $prop)) throw new Exception('The specified cookie is invalid...');
        return $this->$prop;
    }
  
    /**
     * The set method, which handles the four basic cookies vars for user who has just successfully logged in.  
	 * If operation is successful, the method returns a Boolean value True, so it can be used in conditional statement.
     * @access public
     * @return Boolean
     */
    public function setcookies($username){
        $mysidia = Registry::get("mysidia");
		ob_start();
	    $Month = 2592000 + time();
	    $this->mysuid = $mysidia->db->select("users", array("uid"), "username = '{$username}'")->fetchColumn();
        setcookie("mysuid",$this->mysuid,$Month, "/", $_SERVER['HTTP_HOST']);
		$this->mysusername = $username;
        setcookie("mysusername",$this->mysusername,$Month, "/", $_SERVER['HTTP_HOST']);	 
        $session = $mysidia->session->getid();
        $this->myssession = md5($this->mysuid.$session);	 
        setcookie("myssession",$this->myssession,$Month, "/", $_SERVER['HTTP_HOST']);	 
	    $this->mysactivity = time();
	    setcookie("mysactivity",$this->mysactivity,$Month, "/", $_SERVER['HTTP_HOST']);
	    $this->mysloginattempt = 0;
	    setcookie("mysloginattempt", $this->mysloginattempt,$Month, "/", $_SERVER['HTTP_HOST']);
		ob_flush();
	    return TRUE;
    }
	
    /**
     * The setadmincookie method, which handles admincp related cookies.  
	 * If operation is successful, the method returns a Boolean value True, so it can be used in conditional statement.
     * @access public
     * @return Boolean
     */
    public function setAdminCookies(){
        $mysidia = Registry::get("mysidia");
		ob_start();
		$Month = 2592000 + time();
        $session = $mysidia->session->getid();
        $this->mysadmsession = sha1($this->mysuid.$session);	 
        setcookie("mysadmsession",$this->mysadmsession,$Month, "/", $_SERVER['HTTP_HOST']);	
		$this->mysadmloginattempt = 0;
	    setcookie("mysadmloginattempt", $this->mysadmloginattempt,$Month, "/", $_SERVER['HTTP_HOST']);
		ob_flush();
	    return TRUE;
    }

	/**
     * The delete method, which gets rid of cookies to enable users to log out of the site. 
	 * If operation is successful, the method returns a Boolean value True, so it can be used in conditional statement.
     * @access public
     * @return Boolean
     */
    public function deletecookies(){   
	    $expire = time() - 2592000;
		ob_start();
        setcookie("mysuid", "", $expire, "/", $_SERVER['HTTP_HOST']);
		setcookie("mysusername", "", $expire, "/", $_SERVER['HTTP_HOST']);
        setcookie("myssession", "", $expire,"/", $_SERVER['HTTP_HOST']);
	    setcookie("mysactivity", "", $expire, "/", $_SERVER['HTTP_HOST']);
	    setcookie("mysloginattempt", "", $expire, "/", $_SERVER['HTTP_HOST']);
		ob_flush();
	    return TRUE;
    }

    /**
     * The login method, which evaluates the login attempt of a guest user.
     * @access public
     * @return Void
     */
    public function logincookies($reset = FALSE){
        if(!$reset) $this->mysloginattempt++;		
	    else $this->mysloginattempt = 0;
		ob_start();
		$Month = 2592000 + time();
	    setcookie("mysloginattempt", $this->mysloginattempt,$Month, "/", $_SERVER['HTTP_HOST']);
		ob_flush();
    }

    /**
     * The admLogin method, which evaluates the login attempt from admin control panel.
     * @access public
     * @return Void
     */
    public function loginAdminCookies($reset = FALSE){
        if(!$reset) $this->mysadmloginattempt++;		
	    else $this->mysadmloginattempt = 0;
		ob_start();
		$Month = 2592000 + time();
	    setcookie("mysadmloginattempt", $this->mysadmloginattempt,$Month, "/", $_SERVER['HTTP_HOST']);
		ob_flush();
    }  	
}
?>

Edit: Okay, I'm so sorry... I don't know what's wrong with me. The class_cookies file needs to be swapped again. It's correct now.
 
Last edited:
Okay, it seems to be working so far...hopefully the reset tomorrow works as well (since that's where I was running into major issues with Kyttias's game script).

Thank you, Wallie :)

Edit; Just a note, all of my users have had to log out and then log back in to get it to work correctly.
 
Last edited:
Okay, it seems to be working so far...hopefully the reset tomorrow works as well (since that's where I was running into major issues with Kyttias's game script).

Thank you, Wallie :)

Edit; Just a note, all of my users have had to log out and then log back in to get it to work correctly.

I hope it works out for you! :D
 
Looks like the files might not have all uploaded to the right spot. Try reuploading the files. If you didn't before, use Filezilla or something similar to drag and drop the files inside the zip.

Hope this helps.

For some reason, it duplicated the games folder. deleting one of them helped. Thanks!
 
This one does the same exact thing as Kyttia's hi-lo game-- if you get it correct, it malfunctions and stops working
 
It's really weird two of you are having issues when I know three or four of us are using it actively on our own sites without issue... I almost want to ask if you guys are using a certain browser? (I develop mostly in Chrome, but my gf tests everything in FireFox.) Do the JSBin previews in both our threads present the problem for you?
 
The JSBin preview is perfectly fine, and I am using Google Chrome. Many of my users are experiencing the issues, sadly (and they use a wide range of browsers). However, the HiLo game has been working fine since the most recent update of it.
 
I also had the problem with it not working correctly but after clearing my cookies it fixed itself. That might be an issue with some people?
 
I needed to put jQuery in my template to make it work, that might be the problem for others
 
Tested this now that I have jQuery in my template and it seems to be working so far. I'll have to wait out the time-stamp to know for sure.

EDIT: After waiting out the time stamp I had issues where I just could keep replaying it but not ever receive a reward. I just replaced the sendscore.php file with that from the HiLo game, changed "HiLo" to "Word Scramble" and now it's working perfectly!
 
Last edited:

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top