User Tag List

Results 1 to 9 of 9

Thread: Item list - find a line by string and delete it

  1. #1
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    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)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    497
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Item list - find a line by string and delete it

    I painted myself into a corner where I need to find a line in a LIST item and delete it and all I have is the name of the line (string value)

    I tried running a loop to scan the list item for that line, but it didnt work for some reason. I am not setting the loop right.

    Is there a way to do this in fusion? Right now you can remove a line only by index number.
    Couldnt find any examples out there for that. Sorry

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Chrille's Avatar
    Join Date
    Jul 2006
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just recently discovered the Find-functions for both the List and the String Parser objects. It's really useful stuff and saves you using a loop, unless you want to Delete more than one line of course.

    As Snail said, just choose "Delete a Line" and for the expression, select the List object and "Find String". This will return the number of the Line matching, or containing, the String. Anyway, when you use Find String it will ask you to enter the String to look for and also a Flag value. I must say I don't understand how the latter works here, but I set it to zero and it works for me.

  3. #3
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    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)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    497
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    I did it with a fastloop and it works, but now that you mention it can be done in a cleaner way I want to try it.
    Can you post me a simple example?

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUnicode Add-onInstall Creator

    Join Date
    Jul 2006
    Posts
    1,018
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This "flag" in the search expression is the starting index for the search.
    It's explained in the help file.

  5. #5
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    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)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    497
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    I am not sure how to do this still

    Please post me an example file. Anything will do.

    A list with three different lines in it and a string value.
    Fusion searches for the string value in the list and deletes it if found - at the press of a button or start of frame

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Chrille's Avatar
    Join Date
    Jul 2006
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The file contains examples with and without loops.

    exampleFindString.mfa

  7. #7
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    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)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    497
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    This is absolute GOLD! Thank you so much

    And so much simpler than the loop approach. This should be included in fusion as an example file.

    Is it cheaper to do with the find string command or the loop approach? Any fusion experts out there?

    Say if I have 300 items, the loop will run that many times. But if under the hood fusion runs a loop 300 times with the find command anyways - then there is no difference.
    Does anyone know what fusion does under the hood?

  8. #8
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    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)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    497
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Its time to redo some of the code then
    Snail> you have always had great insight on fusion. Your tutorials are a pleasure to read/watch.

    Would it be possible to make a centralized place/tag or article on tips in how to do things in a cheaper cpu way in fusion? Like the list you just posted but extended to other things.
    Fusion is powerful and can do a thing in a number of ways. But sometimes I am not totally sure which way is the optimal.

    I wish there was one place where I can just look at a quick cheat list to see which is cheaper to do.


    Is it possible to count the number of specific items in a list with the find string command? Right now I am doing it with a loop that runs the number of items are in the list, adds +1 to a value when it stumbles on a name.
    So if I have

    potion
    potion
    antidote

    I get

    potion value = 2
    antidote value = 1

    Also what is the difference between findstring and findstringexact. When should I use findstringexact?

  9. #9
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    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)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    497
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    I am going to give this a try tomorrow. Thank you Snail!

    It is sort of how the item inventory system works at the moment when scanning the container list and feeding into the GUI list.
    But in my case the loop runs by the number of items that are in the container list - runs once when you open the equipment menu,another time when it needs to update the equipment at the use of an item. It is a bit overcomplicated.

    What I dont like about it is that I need to write an entry for each individual item type/id in the code.

    So when checking the number of items- check for potion during the countLoop,
    another line of code - check for antidote during the countloop and so no.
    Each item has its own ID value, but I cant use the loopindex to point to it in my expression. It just wont run the code when I do that (conditions not met) .

    After the checking stage, I transfer all the temp count values to an ini object. And reset them to 0 for the next time there will be a check.
    Again I have to do this for each individual item (antidote, potion, etc)

    Finally resetting the gui item list and adding the acquired data from the storage list to it again. I have to do this for each individual item I have.

    I tried to use the fastloop index ID to point out to the item that is tested in my code, instead of manually adding a line of code for each item id check (potion "0", antidote "1" and so on), but it didnt work.

    That is inneficient laborious work, but I cant figure out how to do it with less lines of code.

Similar Threads

  1. What exactly is the list's "Find String"?
    By BartekB in forum Fusion 2.5
    Replies: 8
    Last Post: 17th October 2014, 12:54 PM
  2. Find String Exact List help
    By Sumo in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 30th May 2013, 09:51 PM
  3. list object's "find string exact" help
    By Sumo in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 25th November 2012, 08:09 AM
  4. Delete line from List View - for mmf2
    By Nick in forum File Archive
    Replies: 1
    Last Post: 20th March 2009, 04:51 AM
  5. Find word in a file then delete the whole line ?
    By Rushino in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 15th November 2006, 07:07 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
  •