Thread: Mys 1.3.4 Higher Or Lower Game
View Single Post
  #1  
Old 12-30-2015, 06:40 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,501
Kyttias is on a distinguished road
Arrow Higher Or Lower Game

Higher Or Lower Guessing Game

Try it out here (this is also a good place to modify the css to your liking):
http://jsbin.com/cubeze/edit?html,css,js,output

Download Link: http://sta.sh/01mfv39n0h0d

Upload the following files:
games/.htaccess
games/hilo/sendscore.php
games/hilo/hilo.php
games/hilo/hilo.css
games/hilo/hilo.js
hilo.php
view/hiloview.php
Open phpMyAdmin, login if necessary, open up your database, press SQL, and paste in the following:
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;
If done properly, it will probably say "MySQL returned an empty result set (i.e. zero rows)" with a green checkmark. This is not an error!
Note - This all assumes you did not change the prefix for your database from "adopts_" to something else when you first installed the Mysidia framework. If you did, modify the SQL provided above. In addition, inside games/hilo/sendscore.php you will need to change all instances of "adopts_" to reflect your custom prefix.

You should then be able to visit this game at yoursite.com/hilo.


Feel free to modify games/hilo/hilo.css to your heart's content!

Modifying Game Code
There are TWO versions of the .js files. One is human readable (games/hilo/hilo_non.js) but is NOT being used by the game. It exists only for your reference. The other (games/hilo/hilo.js) is obfuscated, making the javascript code nearly impossible to read and therefore harder for users to cheat the system. If you'd like to use the non-obfuscated version while testing, modify the link to the script found at the end of games/hilo/hilo.php. If you'd like to re-obfuscate any changes you've made, you can do so here.
Defaults:
★ Cards are numbered 1 through 16. To modify the number of cards, edit lines 7 and 13 in games/hilo/hilo_non.js.
★ Users can only play 20 times a day. To modify this limit, edit line 5 in games/hilo/hilo_non.js, and on line 4 in games/hilo/sendscore.php.
★ For each correct guess, 25 money is rewarded. To change, modify lines 18, 27 and 49 in games/hilo/hilo_non.js.
(Reminder to re-obfuscate and update games/hilo/hilo.js after making changes! See Modifying Game Code above!!!)
Note - The user's currency is updated with EACH correct guess, but you won't be able to see that until you visit another page. If you'd like to see the user's cash go up LIVE, you'll need to add a class of "money" to a span or div surrounding where the user's currency is displayed on the page. You can do this in classes/class_sidebar.php in the setMoneyBar() function. Surround just {$mysidia->user->money} in a <div class='money'></div>.
★ ★ ★ Let me know of any problems!★ ★ ★



edit @ Feb 4, 1:30PM EST - MAJOR BUG FIX (fixed bug in post #11).
If you have installed before this date, redownload the latest copy, REPLACE sendscore.php, and DELETE all entries in the 'adopts_games' table to prevent corrupt data.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 02-04-2016 at 12:42 PM.
Reply With Quote