Expression Editor Help

dimsdaledimsdale Member Posts: 499
edited July 2012 in Working with GS (Mac)
In the Expression Editor there are a whole lot of "insert Functions"
Where can I find out more about these Functions?

Cheers,
Ross

Best Answers

  • dimsdaledimsdale Posts: 499
    Accepted Answer
    i think i might have found want i wanted in the new manual under Definitions.

    Thanks.
  • tenrdrmertenrdrmer Posts: 9,934
    Accepted Answer
    they are also listed here. http://cookbook.gamesalad.com/definitions
  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    for simple mathematical operations/manipulations of numbers
    … we code with symbols … + - * /

    for more complex mathematical operations we use the languageRoutines in functions

    unfortunately our GS Functions have the designated number to manipulate listed as
    x,y,z … and that has no relationship to the X Y or Z axis in Game Salad
    would have liked them with n, n1, n2 designations

    so when you see something like abs(x) appear in the expressionEditor
    you really want to replace the x with a selected attribute for numberValue … or a number
    EX: abs(game.Score) … for absolute score … i.e. a non-negative number

    often we use the functions to just display a value rather than changeAttribute

    basically one uses
    ceil(x) … which rounds up the selected attribute's number value
    floor(x) … which rounds down the selected attribute's number value
    EX: Display Text: floor(self.Position.X)

    random(min,max) … we can replace the min,max with actual numbers or selected attributes
    EX: changeAttribute: game.Random To: random(1,5)
    or: changeAttribute: game.Random To: random(1,tableRowCount(table))

    of course the functions for tables
    tableCellValue … table must be selected; row/col can be a number or attribute's value
    tableColCount … table must be selected
    tableRowCount … table must be selected

    magnitude … mag(x,y) … values most often are attributes
    vectorToAngle
    max(x,y)
    min(x,y)

    in general: play with some functions in Display Text and see what shows in Preview
    ==
    ignore the trigonometry functions … until you need or need to learn them
    (Trig is not hard … but the jargon can be confusing!)

    ignore the exponential functions … unless you need them

    precision … prec(x,y) is nice when you want to limit the number of decimal places in display

    playing with different things in Game Salad is fun!

    image MH

Answers

Sign In or Register to comment.