Some ideas for hiding Promo Codes

Forum
Last Post
Threads / Messages

Kyttias

Super Moderator
Super Mod
Joined
Jan 26, 2014
Messages
849
Points
18
Mysidian Dollar
58,199
I've taken a tiny break from Mysidia to take a stroll around the proverbial web design block, and I've brought back with me a few fun things that are more-or-less painless to implement:

  1. Konami Code - Many websites (here's a list of 20 well-known examples of sites that have) have implemented the Konami code to do some interesting stuff to amuse visitors.
  2. Hidden in the Context (right-click) Menu - The best example would be to right click on the actual download link. You could probably make a really annoying game of this.
  3. Sliding Door Effect - Imagine hiding one of these unsuspectingly at the bottom corner of a page!
  4. On Pageview Count - This is entirely client-side, so as a warning, the same user could wind up doing it again after a cleared cache or on a different computer.

What are some ways you wish you could implement a promo code reward to appear but just aren't sure how it would be done?
 
What are some ways you wish you could implement a promo code reward to appear but just aren't sure how it would be done?
Well, it'd be nice if when your adoptable grew up fully/reached x level, a promocode would appear. Or if they collected 100 adults or etc., a promocode would appear. (I know you're more of a designer; I was just curious.)
 
squiggler, there is an option to have a user receive a promocode when an adoptable reaches a certain level, already.


Now what I'd really love is to implement a mini-games feature that rewards users with a promocode when they win. I figured this out on an older version of the script (though it wasn't very secure Javascript), but since the massive updates I've been stuck with that bit XD
 
My mind's been on developing some simple games in jQuery or in HTML5's canvas, but I haven't gotten there quite yet. I was wondering what sort of basic mini-games people might like (that already exist in some form on the web), like... Tetris, Snake, Asteroids... But I also want to learn how to hook them up with the currency system.

If I do get around to building actual mini-games that way, I'll gladly offer up at least one as example template for how the currency hook up works (which I haven't even begun to look into), and provide something simple enough that anyone can use it, and even optionally easily swap out the graphics for something that fits their site better.

There's a good, free, and very basic HTML5 Canvas game maker called Tululoo, if you want to check it out. It's not the most advanced program, but it allows you to do quite a bit without any coding knowledge directly.
 
Well, you could have them give a promocode that can only be used once that gives a valuable type item. They can then sell that for money.

To swap the graphics out, what about creating a folder where all your images are stored, and then we could upload our own with the same file names (over-writing the files)?

Tululoo is awesome. I'm definitely checking it out.
 
Well, you could have them give a promocode that can only be used once that gives a valuable type item. They can then sell that for money.

Interesting - this is definitely a thought. Might be fun to do this for achieving hard to accomplish feats in a game.

To swap the graphics out, what about creating a folder where all your images are stored, and then we could upload our own with the same file names (over-writing the files)?

This was sort of my thought exactly, with instructions to keep in mind that unless images are exactly the same dimensions in pixels, sometimes code might need to be changed to make those graphics fit, and that if a larger design is made than the template allows, there will need to be some code edits.
 
You can set the buy price to whatever you want, but I'm not sure how the sell back works...okay. Bought a ring from the store for 50, got 25 back. So it's probably halved.
Anyway, this means if you have levels, you can pause the game each level and give whatever you feel is appropriate.

I think keeping with the dimensions (and having a dimension list) is simple enough. However, if you want to provide an explanation of how to accommodate smaller/larger sizes, more advanced users would probably appreciate it.
 
Well, I'd like to add the konami code and make it give a promo code but I don't understand how to add the stuff.
 
Konami Code Install

1 - You need a link to jQuery. My Bootstrap theme comes with it. If you don't have it, hop into **root**/templates/**your theme**/template.tpl and before </body>, add this:

HTML:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

2 - Open up notepad, paste this in, and save it as jQuery_konami_code.js in the /js folder at the base of your Mysidia framework installation. So it will be **root**/js/jQuery_konami_code.js.
HTML:
;(function( $, window, document, undefined){
  var keys = []

  $.fn.konami_code = function( options ) { 
    var settings = $.extend(true, {}, $.fn.konami_code.defaults, options )
    var executionCount = 0
    
    $(this).keydown(function(e) {
      if(settings.maximum > executionCount){        
        keys.push( e.keyCode )
      }
      // console.log(keys.toString()) 
      if ( keys.toString().indexOf( settings[settings.activeCode] ) >= 0 ){
        // execute the specified callback function when the activeCode is detected
        // if I ever use event triggers I'll need to append the event argument object to the end of settings.arguments
        settings.callback.apply( settings.scope, settings.arguments )
        executionCount++;
        // empty the array containing the key sequence entered by the user
        keys = []
      } else if (keys.length >1000) {
        keys = [] //a crude way to keep the array from getting too big for no reason--a better check would be to clear after a long delay between keypresses (400-800ms)
      }
    })
    console.log('konami_code: power on')
    return this
  } //end $.fn.konami_code()  

  defaultCallback = function(){
    console.log("power up")
    alert("power up")      
  }  

  $.fn.konami_code.defaults = {
    konami: '38,38,40,40,37,39,37,39,66,65',       
    SFII: '40,82,38,76,89,66,88,65',
    callback: defaultCallback,
    activeCode: 'konami',
    maximum: 1000000000000000,
    scope: window
  }
})( jQuery , window, document)

3 - Now you will need to link to it. Go back to **root**/templates/**your theme**/template.tpl and after the jQuery link from step 1, and before the end of the </body>, add in this (the $home variable will automatically find the root folder and does need to be changed in any way):
HTML:
<script src="{$home}js/jQuery_konami_code.js"></script>

4 - After this we need to initialize, that is, prepare the code. So, right after what we just did, we'll add this:
HTML:
<script type="text/javascript">
    myCallback = function(){ alert('yay!') }
    $(document).konami_code({ callback: myCallback })
</script>

Right now, it's creating a javascript alert window that contains 'yay!'. See how it's working alert('yay!') in the script above?

This code is now operational on every page in your site. As a reminder, the Konami Code is up, up, down, down, left, right, left, right, b, a. For some further reading on how this code can be modified, check out the github repository for it.
 
I'm curious how I would alter the message. I want it to appear like this:


Congratulations!
You've discovered the Promo Code for the: Konamibunny

Code: PROMOCODEHERE

Enter it on the Promo Code page: http://chibifurs.elementfx.com/promo

It would be awesome if it played a defined sound as the box pops up too.
If possible, what format would the sound need to be in and how long?

Is it also possible to alter the code so only members can enter the code and not a guest or nonlogged user?
 
Last edited:
Promo codes can already only be entered by logged in users. A non-logged in member would be able to press the sequence of keys to display the alert, but they probably would not know to, nor is there any harm in letting them...?

To change the text in the alert prompt, simply follow the instructions already given and replace the word 'yay!'. Alert prompts cannot be styled in any way. If you want to pop up a div and have it styled with css instead, learn Javascript or jQuery. Or, if you're using Bootstrap already, perhaps install and learn to use Bootbox.js.

If you want to play a sound, here's the top result I got from Google.
 
I've managed to at least put each piece on its own line via MANY spaces so yay! I'll make an attempt with the sound later.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

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

Latest Threads

Latest Posts

Top