0 Favourites

[Plugin] Extra Expressions

  • Here is my very first plugin for Construct 2! *drum rolls*

    <font size="6">Extra Expressions</font>

    <font size="3"><font color="red">Version: 1.1 (11th January)</font></font>

    <font size="3">Download ExtraExps.zip</font>

    To install, extract the contents to Construct 2\exporters\html5\plugins folder.

    To use, simply start entering an expression where applicable, like this:

    ExtraExpressions.char2code("A")

    Tip: You can rename the object to a suitable shorthand, such as ExtExp

    The plugin contains miscelaneous expressions that complement the system expressions. It is kind of pointless to create a plugin for each expression, so I decided to create Extra Expressions plugin containing all regularly used expressions.

    <font size="3">LIST OF EXPRESSIONS</font>

    find(text, source) - Case sensitive version of system find expression. Find text within source text.

    char2code(char) - Returns the charcode of a character (or the first character of string)

    code2char(code) - Returns the character from charcode

    cosp(a,b,t) - Cosine interpolation between points a and b

    --- NEW ---

    offsetX(x,angle,distance) - Returns the x position at an offset by distance at angle.

    offsetY(y,angle,distance) - Returns the y position at an offset by distance at angle.

    snap(number,gridsize) - Returns the number snapped to grid size (e.g. 25.5 snapped to 16 returns 32).

    encode(string) - Encode the string to Base64

    decode(base64) - Decode the encoded string from Base64

    findToken(text,token,delimiter,case sensitivity (0 or 1)) - Find token in text, returns its index if found or -1 if not found.

    ---

    Yeah, just a few expressions for now, but be sure that I will be adding more. Got any suggestions? Better terminology? Drop a line here!

  • Must have missed this post <img src="smileys/smiley5.gif" border="0" align="middle" />

    Many thanks. These will be useful :)

  • Nice plug-in! I think it will be very useful.

  • I liked it.

  • Oooh, Snap will be useful!

  • Pretty great idea..thanks Mipey

  • Suggestion.

    I don't know how hard it would be, and I'm guessing Scirra will introduce this some time in the future themselves. But I'm currently killing myself setting up level(layout) changing by having to make an event list of every single level available in a game bound to a variable's specific value for example, instead of a changing the level by expression.

    Long story short: "Go to layout by expression".

    Now, I guess it's technically an action, but an expression-dependent action so it might be a good addition to the Extra Expressions plugin.

    For your consideration, thanks!

  • <font color=red>Update!</font>

    I've added encode and decode expressions for Base64 string encoding/decoding. Base64 is a highly useful encryption method that prepares data for sending over HTTP protocol. It also has other uses, such as obfuscation.

  • cool, certainly gonna try this out!

  • Oops, forgot to sync the dropbox folder. Should be available now.

    Note to self: don't work past midnight. And don't feed the gremlins any meat.

  • I think the devs overlooked this one when they added the tokenXXX expressions...

    How about adding this oversighted findToken expression for finding which position a token is at if it is in the list. 0 is a valid position doing things the C2 way so -1 may need to be used as the "not found" result.

    eg 1: findToken("catacombs,cat,catastrophic,triplicate","cat",",") should yield 1

    eg 1: findToken("catacombs,cat,catastrophic,triplicate","ata",",") should yield -1

  • Added the findToken expression.

    Parameters:

    text - str - text to tokenize

    token - str - token to find

    delimiter - str - delimiter to split text by

    case sensitivity - int - case insensitive (0), case sensitive (1)

  • I dont know if its possible but could You add "collision at offset", would be perfect for my project :D

  • That one is kind of complex and can be done with invisible sprites, so-called "detectors", so kind of redundant.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • You're right. Maybe an "Else" condition? (probably its very hard too), or "if not colliding" with sth or anything. (im just asking, not making any pressure or something)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
1,068 148,661
Reflextions's avatar
Reflextions
Unread hot topic
0 Favourites
[plugin] firebase
687 65,136
cybertron7's avatar
cybertron7
Unread hot topic
0 Favourites
[PLUGIN] Canvas
627 186,682
zenox98's avatar
zenox98