Simple protection of published game. Part Two.

  • 33 favourites

Index

Attached Files

The following files have been attached to this tutorial:

.capx

the-sitelock.capx

Download now 177.78 KB

Stats

2,871 visits, 8,210 views

Translations

This tutorial hasn't been translated.

Tools

Prepare your events - continuation

You have your game. You know how to sitelock it.

Let's make a game that could be uploaded and sitelocked to following pages:

- scirra arcade,

- dropbox

- kongregate,

Before we do that we will modify our Set tmp to Browser.Domain action a bit. Just to make sure Browser.Domain will always gives us a string that looks like "xxxxxx.yyy" (example.net or scirra.com).

We use tokenat and tokencount expressions for that. And it look like this

tokenat(Browser.Domain, tokencount(Browser.Domain, ".") - 2, ".")

& "." &

tokenat(Browser.Domain, tokencount(Browser.Domain, ".") - 1, ".")

This may looks scary but it's really not. Let me show you step by step what is going on. And we use dropbox domain as an example.

tokencount(Text, Separator) - this expression simply counts tokens between separators. In our case "." (dot) is our separator and every strings between dots are our tokens.

Browser.Domain gives us this: dl.dropboxusercontent.com

tokencount will return 3 because there are 3 elements between dots:

dl dropboxusercontent com

Now when we know that, we have this

tokenat(Browser.Domain, 3 - 2, ".") & "." & tokenat(Browser.Domain, 3 - 1, ".")

which gives us this

tokenat(Browser.Domain, 1, ".") & "." & tokenat(Browser.Domain, 2, ".")

tokenat(Text, Index, Separator) expression returns Nth token from the string - this is 0-based.

tokenat("I think you have lost my friend", 0, " ") - will return "I"

tokenat("I think you have lost my friend", 3, " ") - will return "have"

tokenat("I think you have lost my friend", 6, " ") - will return "friend"

" " (space) is our separator. everything in between are our tokens.

Domain name = dl.dropboxusercontent.com

tokenat(Browser.Domain, 1, ".") - will return "dropboxusercontent"

tokenat(Browser.Domain, 2, ".") - will return "com"

Moving on

tokenat(Browser.Domain, 1, ".") & "." & tokenat(Browser.Domain, 2, ".")

now looks like this

"dropboxusercontent" & "." & "com"

which in final version looks like this "dropboxusercontent.com" - our proper domain name we needed.

Let's apply this to our event and add few more webpages to our sitelock.

We can use simple "OR" condition and add as many pages as we want.

Yay! we just sitelocked our game!

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!