User Tag List

Results 1 to 7 of 7

Thread: Question about splitting a floating Value after a decimal point

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2015
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Question about splitting a floating Value after a decimal point

    hi there,

    the question is like described in the title
    Global Value A = 6.03845

    How can i split this Value in:

    Global Value B = 6
    Global Value C = 03845 or rounded: 04

    Thanks in advance!

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Hey!

    Use the String Tokenizer object!

    * Start of frame
    - String Tokenizer: Split string -> Str$(Global Value A ) with Delimiter '.'.
    - Set Global Value B to Val(Element$( "String tokenizer", 0 ) )
    - Set Global Value C to Val(Element$( "String tokenizer", 1 ) )

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2015
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it works! thanks for explaining the string tokenizer object!
    have a nice weekend... and thanks again

    edit:
    another question - sorry
    global value c is now "3845" -> but what is with the leading "0"?
    i know that mmf is deleting zeros at the beginning of a value. is there a solution for this?

    thanks again

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    That is because 03845 = 3845. Fusion doesn't know that this is actually the decimal part of a float value, so it get rids of the unnecessary 0's. One solution would be to store the value in a Global String instead.

  5. #5
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2015
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! Again

  6. #6
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you still care about this, it can be done without the tokenizer.
    Attached files Attached files

  7. #7
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2015
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey, another solution - and a very good one!
    Thanks for that!!!

Similar Threads

  1. [BUG] floating point rotation
    By SolarB in forum iOS Export Module Version 2.0
    Replies: 5
    Last Post: 2nd December 2012, 01:40 AM
  2. Floating Point Rotations
    By Quinto in forum SWF/Flash Export Module Version 2.0
    Replies: 0
    Last Post: 22nd June 2011, 03:16 PM
  3. rotation using floating point
    By JimCarter in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 11th February 2010, 04:52 PM
  4. [Bug]Floating Point issues
    By xyzzy in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 10th January 2008, 12:13 AM
  5. How to force floating point?
    By Pixalatio in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 7th July 2006, 04:15 PM

Posting Permissions

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