This minimalistic example provides you with a function to shuffle strings. That is, returned string contains all characters from source string, but mixed in random order.
Code follows,
Continue reading⚂ Right here and right now
This minimalistic example provides you with a function to shuffle strings. That is, returned string contains all characters from source string, but mixed in random order.
Code follows,
Continue readingSome time ago I've made a UDL2 definition for Lua-based programming language called Killa.
Actually I was planning to wait until next version of language will be released (which alters standard module names, among other things), but apparently that isn't going to be that fast, so here it is.
If you don't know what Killa is, it's a Lua-based scripting language, which adds some JavaScript-like syntax parts (including proper for-loops, bitwise operators, ternary operators, assignment operators, and more) while keeping the pleasing parts of Lua in. Also it does not allow you to accidentally leak variables in global scope, which excludes possibility of common Lua "silent errors". There's also a topic about it here. You can read more about it there, if this sounds interesting for you.
This example provides a function to substitute all characters in a string, which present in first set of characters, by characters from second set. This can be used to substitute l/e/a/s/t/o characters in a string by 1/3/4/5/7/0 accordingly, turning your "Hello World" into "H3110 W0r1d" in single script call, or to replace/swap characters with completely irrelevant ones, providing simple "encryption" (e.g. Caesar cipher or various substitution methods) to challenge the player.
Functional part is presented by a single script, named string_subst(string, from, to), which returns string with all characters from set from replaced by according characters from set to. As long as both from and to are of equal length and do not contain repeating characters, output can be "decrypted" by passing parameters in swapped order, e.g.
var asrc, adst, source, encr, decr; asrc = "0123456789"; // source "alphabet" adst = "3456789012"; // destination "alphabet" source = "51"; // source text encr = string_subst(source, asrc, adst); // "encrypted" text show_message(encr); // Displays "84;" decr = string_subst(encr, adst, asrc); // "decrypted" text show_message(decr); // Displays "51;"
Attached example demonstrates both "encryption" and "decryption", and has nice buttons.
Continue readingIf you've been visiting GameMaker Community lately, you might've noticed that forum software update has switched the light theme to new default IPB blue theme.
That is going to be fixed soon (hopefully!), but until then, there's a small solution if you're not too keen of mixed standard blue-green-pink(?!) palette.
First, ensure that you have a browser plugin to add support for userstyle. Seems that a commonly used one is Stylish, but there are also other options.
Also ensure that forum is set to default (blue) theme.
Then, create a new style in said plugin.
"Applies to domain" field would to be set to "gmc.yoyogames.com", obviously.
CSS contents can be downloaded here:
After clicking "Save" and refreshing page, theme will appear green-coloured, more or less mimicking the previously used green theme (except maybe slightly softer, since it's a quick CSS recolour of new standard theme).
Optionally, you can also download a ZIP archive with related files, so you can easily substitute links in CSS and host images wherever loads fastest for you.
Should be good.
Recently I was searching for at least relatively high-definition icon for Haxe (programming language), and found that there ... just isn't one. The best I could find was icon used on someone's blog, and that had white seams at shape intersections (suggesting anti-aliasing problems).
So I've made one.
The whole icon (after a few manual optimizations) is 1108 bytes, is in SVG format, and seems to meet proportions of original perfectly.
Also sections of icon are made to partially overlap "behind the scenes" to avoid earlier mentioned white seams on shape boundaries.
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128px" height="128px" viewBox="0 0 128 128" xml:space="preserve"> <g> <rect fill="#f7941e" width="96" height="96" x="16" y="16"/> <polygon fill="#fdb813" points="0,0 4,32 16,64 64,16 32,4"/> <polygon fill="#faa61a" points="0,128 32,124 64,112 16,64 4,96"/> <polygon fill="#f36f21" points="128,128 124,96 112,64 64,112 96,124"/> <polygon fill="#f58220" points="128,0 96,4 64,16 112,64 124,32"/> <polygon fill="#ffcb08" points="0,0 64,16 32,0"/> <polygon fill="#fff200" points="0,0 0,32 16,64"/> <polygon fill="#fff200" points="0,128 16,64 0,96"/> <polygon fill="#f4813c" points="0,128 32,128 64,112"/> <polygon fill="#f7941e" points="128,128 64,112 96,128"/> <polygon fill="#f15922" points="128,128 128,96 112,64"/> <polygon fill="#f15922" points="128,0 112,64 128,32"/> <polygon fill="#ffcb08" points="128,0 96,0 64,16"/> </g> </svg>
The idea behind this effect is simple enough - for every string character that should be randomized, replace it with any other character that has same width (so that the drawn string would not wiggle chaotically).
It uses 3 scripts total - one for general initialization, one for per-font init (creating a map of lists for what glyphs any given one could be replaced with), and one for actual string processing.
Can be handy for various abstract pieces, or as an interesting way to censor text.
Text versions follow,
Continue reading
This rather cute-looking example demonstrates creation of 3d-person camera in GameMaker' 3d. And character rotation. And a few other things.
Descriptions and explanations following,
GameMaker has a built-in keyboard_string
variable that lets you do simple text entry,
but what if you also want a caret
(so that the user can enter/erase text in the middle of the string)?
This is a post about that - a pretty reasonable input field.
Originally posted on Mar 16, 2013 (archive), revised in 2023.
Continue readingIf you've ever disabled casting of shadows by desktop icons in Windows 7 (System - Additional system parameters - Performance), you might have noticed that it's not possible to set actual colour of icon/thumbnail captions.
It is said, that Windows decides that on it's own, judging from image colours (luminance?).
But is it always the right decision?
Probably not. Time to time I get things like these:
However, despite of it being said that this is automatic, there is is a way to influence decision of system on deciding with a colour. And it is actually a simple one.
Continue reading