User Tag List

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

Thread: Substring Replace cuts out part of short strings for no reason

  1. #1
    Clicker Multimedia Fusion 2SWF Export Module
    Tsun's Avatar
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Substring Replace cuts out part of short strings for no reason

    So I'm using the Substring Replace object, to change a keyword in a string into the contents of a Global String. It's used in my chat system.

    It works fine, except for sometimes when there is a short sentence. For example, "XXX: ..." becomes "XXX:", "Mmm..." becomes "M", "Well..." becomes "Wel", "How come?" becomes "How com".

    Currently there is only one keyword, and neither that nor the Global String match any of the above strings. It seems to happen in the same places every time, and it removes the same part every time. However, some short strings don't change at all, for example "..." will always be "...". Long sentences never seem to be affected at all. If I remove the Substring Replace event, all the problems disappear.

    Any idea why this happens?

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    No idea as I have never used the Substring Replace object before... wasn't even aware one existed. Why are you using this instead of just using the string functions in MMF to replace strings?

  3. #3
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Example or it didn't happen.

  4. #4
    Clicker Multimedia Fusion 2SWF Export Module
    Tsun's Avatar
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Konidias View Post
    No idea as I have never used the Substring Replace object before... wasn't even aware one existed. Why are you using this instead of just using the string functions in MMF to replace strings?
    I couldn't figure a way to replace a part of a string with something else by using the standard MMF functions.

    Quote Originally Posted by MuddyMole View Post
    Example or it didn't happen.
    There you go.
    https://dl.dropbox.com/u/32968627/St...placederps.mfa
    click the chat box to proceed the dialogue

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    happygreenfrog's Avatar
    Join Date
    May 2011
    Location
    I.L.T.D.O.I.R (I.L.T.D.O.I.R's Location: The Dimension Of Infinite Recursion)
    Posts
    4,307
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MuddyMole View Post
    Example or it didn't happen.
    LOL. Anyway, this is an unusual-sounding issue, possibly a bug in the extension, possibly a bug in Tsun's code.

  6. #6
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Here's an example of replacing a word in the middle of a string.

    Not sure it's exactly what you need, but this one doesn't require extensions. Anyway, hope it helps.

    replacetextexample.mfa

  7. #7
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tsun View Post
    There you go.
    https://dl.dropbox.com/u/32968627/St...placederps.mfa
    click the chat box to proceed the dialogue
    Works fine here.
    You're just using an outdated version of the extension (the latest is version 2, which has a different icon).

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    Alonso's Avatar
    Join Date
    Jul 2006
    Posts
    681
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I had this issue once. It's related to the number of characters of the string vs the ones being replaced. If the number of characters of the string being replaced is bigger than the remaining characters, it seems to wrap around the character length for some reason. I think I worked around this by being sure the remaining character count was always bigger than the string being replaced, but it's a silly problem and a silly solution indeed.

  9. #9
    Clicker Multimedia Fusion 2SWF Export Module
    Tsun's Avatar
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MuddyMole View Post
    Works fine here.
    You're just using an outdated version of the extension (the latest is version 2, which has a different icon).
    Whattt
    I went to the site to download the thing 2 times to be extra sure I had the new version. Where can I get it then? I downloaded it from here: https://sites.google.com/site/jlnweb...string-replace

    The file says it was modified in 2011, but the copyright in the object is 2009. I don't know if I'm using the new one...

    I made a new example, here's an .exe of it if you want to see what I'm experiencing: https://dl.dropboxusercontent.com/u/...ingproblem.exe

    Quote Originally Posted by Alonso View Post
    I think I had this issue once. It's related to the number of characters of the string vs the ones being replaced. If the number of characters of the string being replaced is bigger than the remaining characters, it seems to wrap around the character length for some reason. I think I worked around this by being sure the remaining character count was always bigger than the string being replaced, but it's a silly problem and a silly solution indeed.
    That's strange yeah. But thanks, you just gave me an idea that I should've had a long time ago. I just added a bunch of empty spaces after my strings, and that fixed it. I'd rather fix this bug/problem, but this'll work for now.

    Quote Originally Posted by Konidias View Post
    Here's an example of replacing a word in the middle of a string.

    Not sure it's exactly what you need, but this one doesn't require extensions. Anyway, hope it helps.
    Oh, thanks! I don't really get how it works at the moment, but I'd highly prefer doing this without extensions, so I'll look into it when I get some time.

  10. #10
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tsun View Post
    Whattt
    I made a new example, here's an .exe of it if you want to see what I'm experiencing: https://dl.dropboxusercontent.com/u/...ingproblem.exe
    What am I missing?

    tsun.JPG

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Substring replace Object...
    By Earl in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 6th February 2019, 02:12 PM
  2. 'Substring Replace' Updated
    By Jax in forum Extension Development
    Replies: 12
    Last Post: 18th December 2009, 09:03 PM
  3. Sub application/key board short cuts
    By Skeets in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 2nd October 2007, 02:27 AM
  4. Substring Replace
    By LIJI in forum Released Extensions
    Replies: 0
    Last Post: 5th February 2007, 11:18 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
  •