User Tag List

Results 1 to 6 of 6

Thread: Search/highlight a random line of text?

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,308
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Search/highlight a random line of text?

    So, say I have a text file (that can be edited) with the following:
    Line 1
    Line 2
    Line 3
    I would add a "random' button on the tool. It would pick a random line from 1 - 3, and highlight it.

    If I were to add on to the list like so:
    Line 1
    Line 2
    Line 3
    Line 4
    Line 5
    Line 6
    I would want to pick a random line from 1 - 6, and highlight it.

    I also would like to have the option where if it detects a space in between each new line, to NOT register it, like so:
    Line 1

    Line 2

    Line 3

    Line 4
    To skip to another line if there is no text written there, but still select a random line and highlight it.

    What would I need to do to go about this? Do I need variables to detect the # of lines, or a construction of code to read certain text?

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Is there a reason you allow empty lines? If you didn't allow that this is very easy.

  3. #3
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    If the text file is loaded into a list object (and the text file has blank lines) I would have a separate list object for loading the raw text file. Then transfer the non-empty lines one at a time to your final list object.

    Or you could just run a loop on the raw list object line by line, check if the line equals the string " " ( empty) and delete the line if it is.

    Hopefully you don't need to retain empty lines.

  4. #4
    No Products Registered

    Join Date
    Jul 2016
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your suggestion, it help me

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,308
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Well, I suppose empty lines are not necessary then. Also, there isn't a list object being used. It's just a plain, simple text file, if that makes any difference. Though maybe a list object would be better? I don't know, because what I am doing is the text file contains a list of submitted number ID's recorded.

  6. #6
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    I can't think of an easy way for you to read "lines" from a text file loaded into a string object or Alterable string. It will be simpler to work with the text if you load it into a list. I guess you could load it into an array and do the same pruning procedure I mention above, but Lists make it human readable.

    It just sounded like the player is going to be encouraged to open and edit the text file that Fusion will be reading from. And that is never a good idea unless you force them to use a specific syntax and format.

Similar Threads

  1. In a point and click game, how do I add highlight text when clicking on an object?
    By mortified_Archie in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 2nd January 2015, 04:18 PM
  2. Help: Random text line
    By dyslektiker in forum Fusion 2.5
    Replies: 5
    Last Post: 8th January 2014, 01:16 PM
  3. Is there an extension which changes text / field highlight color?
    By ratty in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 5th October 2013, 11:17 PM
  4. Sentence by sentence or line by line movement in Rich Text object?
    By ratty in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 17th March 2013, 11:36 PM
  5. Highlight text word by word - grammar exercises
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 5th September 2011, 05:36 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
  •