Listbox question: Checking to see if an exact string is in the box more than once?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hello guys

    So I'm trying to make a way to beee potions in my game, with conditions that check to see if you have the ingredients in your backpack. I'm using FindstringExact for the inventory listbox and it works great.. UNTIL I want to have a potion that requires more than one of the same ingredient (ex nutmeg + nutmeg). I tried using two Findstrinngexacts with different flags to them but it didn't seem to register both items, only one.

    What I mean is I have only 1 nutmeg in my pack but it's letting me brew the potion that should take two of them to do.

    I know I could do this using multiple lines but I really wanted to be able to do this on a single one if possible.

    Any tips?

    Weebish Mines, my retro Metroidvania!
    Please login to see this link.

  • Have you tried setting up a condition for that recipe that requires > 1 nutmeg?

    I'm not sure how to do that with what I have.

    I just want the one line and right now it has:


    FindStringExact(listbox, "nutmeg", 0) <> -1
    +FindStringExact(listbox, "nutmeg", 0) <> -1

    -> (make the potion)

    But the thing is this will create the potion if I only have 1 nutmeg in my pack.
    If there's a way to see how many stances of an exact string exist in a listbox (in a single conditional event) though please tell me, that'd be awesome!

    Weebish Mines, my retro Metroidvania!
    Please login to see this link.


  • Ok I was able to do this by running a fastloop at the top of the events and tallying the nutmeg lines of the listbox into a global variable. So I'm just checking if nutmeg >= 2 and it worked.

    Weebish Mines, my retro Metroidvania!
    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!