Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #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: 86,973
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
  #2  
Old 12-30-2015, 06:44 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,688
Abronsyth is on a distinguished road
Default

Ah, man, this is so exciting, thank you so much for sharing! I will have to test it out tomorrow!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #3  
Old 12-30-2015, 08:09 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,165
Hwona is on a distinguished road
Default Re

This looks amazing! Do you know if it's compatible with v1.3.3?
__________________
Reply With Quote
  #4  
Old 12-30-2015, 08:40 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,973
Kyttias is on a distinguished road
Default

Quote:
Originally Posted by Wallie987 View Post
This looks amazing! Do you know if it's compatible with v1.3.3?
It should be! This is how it works for v1.3.4 in view/hiloview.php:

PHP Code:
$mysidia Registry::get("mysidia");
$document $this->document;    
$document->setTitle('Higher or Lower');
$document->add(new Comment('<p>Guess if the second number will be higher or lower. The highest possible number is 16.</p>
<iframe id="game" style="width: 100%; min-height: 500px;" src="../../games/hilo/hilo.php?username='
.$mysidia->user->username.'" frameborder="0" scrolling="yes"></iframe>')); 
To make it work with v1.3.3, the most important thing is to make sure that an iframe is made that links to hilo.php with the username as a parameter. Can you see how that works above? I'm not familiar with how pages are constructed in v1.3.3 but if you are, just add in an iframe and it should take care of itself.
__________________
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; 12-30-2015 at 08:44 PM.
Reply With Quote
  #5  
Old 12-30-2015, 08:49 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,165
Hwona is on a distinguished road
Default

Quote:
Originally Posted by Kyttias View Post
It should be! This is how it works for v1.3.4 in view/hiloview.php:

PHP Code:
$mysidia Registry::get("mysidia");
$document $this->document;    
$document->setTitle('Higher or Lower');
$document->add(new Comment('<p>Guess if the second number will be higher or lower. The highest possible number is 16.</p>
<iframe id="game" style="width: 100%; min-height: 500px;" src="../../games/hilo/hilo.php?username='
.$mysidia->user->username.'" frameborder="0" scrolling="yes"></iframe>')); 
To make it work with v1.3.3, the most important thing is to make sure that an iframe is made that links to hilo.php with the username as a parameter. Can you see how that works above? I'm not familiar with how pages are constructed in v1.3.3 but if you are, just add in an iframe and it should take care of itself.
Awesome! I made a JS wordscramble game that failed because I couldn't figure out how to use ajax... user cash wasn't updated. If I can get this to work, I can share the scramble script too.
__________________
Reply With Quote
  #6  
Old 12-30-2015, 08:16 PM
Bexasaurus's Avatar
Bexasaurus Bexasaurus is offline
〈 ᴘʀᴀᴄᴛɪᴄɪɴɢ ᴀʀᴛɪsᴛ 〉
 
Join Date: Aug 2015
Posts: 101
Gender: Female
Credits: 7,447
Bexasaurus is on a distinguished road
Default

This is really cool, thanks for sharing this and contributing.
Reply With Quote
  #7  
Old 12-31-2015, 12:38 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,973
Kyttias is on a distinguished road
Default

Let me know if I can help with your game, Wallie.

I'm hoping to buy a game off CodeCanyon and integrate it with Mysidia, I just need to convince my significant other than its worth the money.
__________________
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.
Reply With Quote
  #8  
Old 12-31-2015, 06:45 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,688
Abronsyth is on a distinguished road
Default

O-oohkay not sure what is going on. I haven't touched any of the script files at all, so everything is original from the download you provided. I am running into 2 issues;
1) The score is not updating at all for me, it remains on 0 regardless of how many times I am getting it correct. It is adding the currency to my account, though.
2) Once I do guess correctly the question-mark card disappears, and if I guess correctly again after that then both cards disappear, though the buttons are still clickable.

GIF of glitches HERE, and HERE is a link to the game on my site itself.

Sorry for being a pain
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #9  
Old 12-31-2015, 11:11 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,973
Kyttias is on a distinguished road
Default

Quote:
Originally Posted by Abronsyth View Post
O-oohkay not sure what is going on. I haven't touched any of the script files at all, so everything is original from the download you provided. I am running into 2 issues;
1) The score is not updating at all for me, it remains on 0 regardless of how many times I am getting it correct. It is adding the currency to my account, though.
2) Once I do guess correctly the question-mark card disappears, and if I guess correctly again after that then both cards disappear, though the buttons are still clickable.

GIF of glitches HERE, and HERE is a link to the game on my site itself.

Sorry for being a pain
That's... extremely weird?? What browser are you using?

(As a PSA, you can also access the game directly without being logged in - it doesn't reward any money to anyone and you can refresh and play forever - http://catisserie.mysidiahost.com/games/hilo/hilo.php )

I can't seem to replicate that behavior at all on my end. D;

Please try using an updated version of the files so I can rule out any problems? I uploaded a newer copy this morning because I left a reference to my css file in and no one has that (it's not important, just additionally styling on my end, no harm to anyone to have left it there, but, yknow, better that it's gone).

I notice that you don't seem to be utilizing jQuery as part of your theme. I don't think that should be a problem, because I include my own link to jQuery for the file inside the iframe, as that's really the only place I'm using it in this. Let's rule out some other stuff first, because if I have to have you include jQuery in your header then I'm also going to have to help you fix your profile tabs. x'D What a mess.
__________________
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; 12-31-2015 at 11:15 AM.
Reply With Quote
  #10  
Old 12-31-2015, 02:29 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,688
Abronsyth is on a distinguished road
Default

I'm using Google Chrome, and I tested it on Firefox but have the same issue. I updated the files, but still to no avail.

Oh my goodness! I thought that I had jQuery in the header since I'm using the tooltips for items, but it turns out I totally forgot to do that, which would explain why tooltips didn't look right XD So I just added it in and everything is working now (as are profile tabs, no worries there)!

I'm so sorry to have bothered you with this! I should have known about that ages ago, ahaha.

Thank you, Kyttias!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
Reply

Tags
ajax, game, higher or lower, javascript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:32 PM.

Currently Active Users: 456 (0 members and 456 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636