User Tag List

Results 1 to 3 of 3

Thread: Sphax Formatted Bug: Char->Int Conversion

  1. #1
    Clicker Fusion 2.5 Developer

    Join Date
    Jun 2006
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sphax Formatted Bug: Char->Int Conversion

    I looped from 1 to 255, converting the int to its char, then converting back from that char to its int.

    Here's what I printed to the list: Str$(LoopIndex("pack"))+"->"+getCharFromInt$( "Formatted object", LoopIndex("pack"))+"->"+Str$(getIntFromChar( "Formatted object", getCharFromInt$( "Formatted object", LoopIndex("pack"))))

    What I wanted to see:
    Code:
    1->->1
    2->->2
    3->->3
    ....
    254->->254
    However, after 127, 128 instead turns into -128, 129 returns -127, and so on, until -1. It's weird:
    Code:
    ...
    125->}->125
    126->~->126
    127->->127
    128->->-128
    129->->-127
    130->->-126
    131->->-125
    ...
    250->->-6
    251->->-5
    252->->-4
    253->->-3
    254->->-2
    Everything before 125 is fine. It's just at and after 128 that char's get converted into wrong ints back.

    Is there anything extension that can convert between Char and Int if this one isn't fixed?

    Edit: String Parser2 has this feature too... and the exact same bug. I guess MMF extensions just think the ascii table goes from -128 to 127. I guess as long as you work under that assumption, I can convert back and forth perfectly.

    I just want to know, is it going to stay this way, or is it a bug that will be fixed? Because I want to go forward with this one way or the other, without having to worry about changing back to the other way later. :P

  2. #2
    Firecodemonkey

    Join Date
    Aug 2006
    Location
    London, UK
    Posts
    461
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Sphax Formatted Bug: Char->Int Conversion

    That's probably intentional, integers are signed by default which puts half its values below 0. As far as computers are concerned it doesn't make too much difference, but that's a hairy issue we won't go into. There is nothing wrong whatsoever with having negative values, so it can't really be a bug...

    If you want to get the character value from 0 - 255 then use this expression

    (value) And 255

  3. #3
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Sphax Formatted Bug: Char->Int Conversion

    I don't know if it's a bug or not... but it was not intentional.

    If you consider that as a bug, I'll correct it asap. If not it will be like that forever.

    IMHO, this can be interpreted as a bug since the resulting number is not equal to the starting number.

    Tell me if you think this is a feature which should be corrected.

Similar Threads

  1. Sphax Formatted object
    By Jeff in forum Released Extensions
    Replies: 7
    Last Post: 21st May 2009, 11:56 AM
  2. Create your own char help
    By Oreo in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 28th July 2008, 11:33 PM
  3. Sphax Formatted object
    By Sphax in forum Extension Developers Lobby
    Replies: 15
    Last Post: 23rd November 2006, 04:17 PM
  4. Sphax Formatted object
    By Sphax in forum Extension Development
    Replies: 4
    Last Post: 23rd September 2006, 06:45 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
  •