User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Make alterable values into floats

  1. #1
    No Products Registered

    Join Date
    Nov 2009
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Make alterable values into floats

    Evidently, they are integers by default. The best I can do is to set the value as a float during runtime. So how do you put it in the code that you want a specific alterable value to be a float and not a int?

  2. #2
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Make alterable values into floats

    For example, change 3 to 3.0

    If you want an entire expression to be evaluated as a float, change all numbers like 2 to 2.0, and add 0.0+ to the beginning of the expression.

    Note that properties cannot be set to floats in the editor. You have to set them as floats at start of frame.
    Working as fast as I can on Fusion 3

  3. #3
    No Products Registered

    Join Date
    Nov 2009
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Make alterable values into floats

    So something like

    Start of frame
    -> Set blah("Active") to 0.0

    would work?

  4. #4
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Make alterable values into floats

    In general you need to "tell" the expression evaluator when you want to use a float.

    Some examples are:
    Set counter to: (value("Counter")+0.0)/100
    Set counter to: value("Counter")/100.0

    However if a variable has been set to be a float, I think that it in expressions will work without those tricks.
    You could do:
    start of frame: Set alterable value A to = alterable value A + 0.0
    - and then use it in expressions. This has a serious drawback though. If you at some other point in your code set the variable to an integer you are back with the previous problem.

    So a rule of thumb, if you need to use floats in some way in your expression evaluation to be sure that your calculations will be treated as floats (see the first two examples)

  5. #5
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Make alterable values into floats

    Yes, but since it simplifies to 0, it will be stored as an integer. Basically, MMF2 uses integers unless you or it needs to use floats.

    EDIT: Andos half-beat me.
    Working as fast as I can on Fusion 3

  6. #6
    No Products Registered

    Join Date
    Nov 2009
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Make alterable values into floats

    Well, I've got alterable value d as the integer 144 initially. The game says:

    Always
    -> Add (Step*1.5)+1.0 to Alterable Value D("Active 5")

    When I play it with Step as 2, however, Alterable Value D remains at 144. It only begins to change when I manually change it to a float with the debugger.

  7. #7
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Make alterable values into floats

    The 'Add' action only works in integers sadly. I don't know if this is intended or a bug.

    Use:

    Set alterable value D to:
    Alterable value D + (Step*1.5)+1.0

  8. #8
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Make alterable values into floats

    I was pretty sure that the "Add" integer bug was fixed at some point... unless it's the demo, perhaps?

  9. #9
    No Products Registered

    Join Date
    Nov 2009
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Make alterable values into floats

    Quote Originally Posted by Andos
    The 'Add' action only works in integers sadly. I don't know if this is intended or a bug.
    As I said, the event works fine when Alterable Value D is already a float.

  10. #10
    No Products Registered

    Join Date
    Nov 2009
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Make alterable values into floats

    Quote Originally Posted by DavidN
    I was pretty sure that the "Add" integer bug was fixed at some point... unless it's the demo, perhaps?
    I thought you could only get a TGF2 demo.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Floats in alterable values on iOS?
    By SirEatAlot in forum iOS Export Module Version 2.0
    Replies: 3
    Last Post: 13th December 2012, 11:45 AM
  2. Global Values & Alterable Values with same names
    By Gustav in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 7th November 2012, 06:15 PM
  3. Alterable Strings as Alterable Values?
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 27th March 2012, 07:14 PM
  4. Display values on screen from Alterable Values
    By mikeh in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 13th May 2008, 01:59 PM
  5. Alterable Strings and Alterable Values limit :(
    By Pedro Almeida in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 13th October 2006, 06:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •