Stencyl 3.4.0 is now out. Get it now!

Suggestion Issue: Event-local/block-local variables


Pages: 1

SirAthos

  • Junior Stencyler
March 15, 2017, 02:15:13 pm
It would be great to have a way to define temporary variables scoped to a particular event. Without it, it's hard to write global custom blocks which require some internal processing.

For example, if I wanted to write a global block which formats a number with a certain number of zeroes padded (displaying a score of 123 as "00123", for instance), it would be ugly to write without a temporary variable.

With a temporary variable, it's easy:
Code: [Select]
format [Number] as text with at least [Width] digits
    var TempFormat:String;
    TempFormat = ("" + __Number);
    while(TempFormat.length < __Width)
    {
        TempFormat = "0" + TempFormat;
    }
    return TempFormat;
« Last Edit: March 15, 2017, 02:15:42 pm by SirAthos »


Issue updated by SirAthos - March 15, 2017, 02:15:42 pm
  • Issue renamed from "Event-local variables" to "Event-local/block-local variables"


rob1221

  • Master Stencyler
  • *
March 15, 2017, 02:56:42 pm
Duplicate of http://community.stencyl.com/index.php?issue=265.0
  • Status changed from New to Duplicate


Pages: 1

Details

  • Reported
    March 15, 2017, 02:15:13 pm
  • Updated
    March 15, 2017, 02:56:42 pm

  • View Status
    Public
  • Type
    Suggestion
  • Status
    Duplicate
  • Priority
    Normal
  • Version
    (none)
  • Fixed in
    (none)
  • Assigned to
    (none)
  • Category
    Design Mode Blocks

Tags