User Tag List

Results 1 to 3 of 3

Thread: Select Next Empty Inventory Slot?

  1. #1
    Clicker Fusion 2.5 (Steam)

    Join Date
    Feb 2016
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Select Next Empty Inventory Slot?

    Hey,
    I've made 10 counters, each going up to 1. I want it so that when you collect a resource (clicking on it) it picks the next empty slot to the left and creates an icon with a counter saying how much of that resource is in that slot. When you pick up another of the same resource, it adds to the counter, while collecting a new resource picks the next slot.
    Is there a way to do this automatically?
    Thanks,
    TooTinyMan

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    SoftWarewolf's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    943
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You'll need to make this, and it's a bit complicated.

    you could do something like this:

    when you collect a new resource, add a character to represent it on an alterable string.
    f.ex "1" = wood, and "2" rock. so when you pick a wood set alterable string A to:
    alterable string A + "1".
    then add 1 to alterable value (by index), at index: Find(Alterable String A( "Active" ), "1", 0)

    this finds where in the string "1" is located on the string, which is the slot number.
    and the amount of each resource is stored on each alterable value.

    to know if the resource has been added compare if Find(Alterable String A( "Active" ), "1", 0) is equal to -1, that means it's not there.
    So if it's equal to -1 then add "1" to alterable string A (then the number to value at index), otherwise skip the character and just add 1 to alterable value at index, since you already added that kind of resource.

    f.ex if you collect rock "2", then wood "1", then water "3", and another water "3".
    your string would be "213"
    and the alterable values would be 1,1,2.

    the reason to put numbers in a string like this, is so you can extract the number and use that to display the icon for your resource. f.ex by just setting the animation direction. so direction 1 = wood, and direction 2 = rock.

    now to update the display, run a fastloop len(Alterable String A( "Active" )) times, then the loop runs for each different kind of resource collected, which is the number of characters in the string, lets call this loop "x".
    on this loop, create the icons by setting the direction to val(Mid$( Alterable String A( "Active" ), LoopIndex("x"), 1))
    this picks out each character one by one and sets the icon correctly.

    now you just need to set the number, which is AltValN( "Active", LoopIndex("x") ) <- alterable value at index


    done, the only hard part now is if you need to remove a resource when it's spent down to 0, but it's managable! i'll explain how if you managed to follow what i've said so far and want to add that.

    the amount of each resource, f.ex rock, is: AltValN( "Active", Find(Alterable String A( "Active" ), "2", 0) ) just replace "2" with the icon number for each resource.

    if you want to spend a resource, you'll need to subtract from alterable value by expression, using the same: Find(Alterable String A( "Active" ), "2", 0)

    the above example supports 10 different kinds of resources, and any number of slots, sorry if this is way above your head, but to make it exactly like you want, with the flexible slots, it needs to be almost this complicated.

  3. #3
    Clicker Fusion 2.5 (Steam)

    Join Date
    Feb 2016
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, thanks!
    I'll try this, and if I can't get it to work I'll try to figure out the Inventory Object/Extension. The only reason I didn't start with the Inventory Extension is because it's confusing and there aren't any tutorials.
    Thanks again!

Similar Threads

  1. How to check wich inventary slot is empty
    By esp in forum Fusion 2.5
    Replies: 3
    Last Post: 8th October 2016, 12:07 PM
  2. Bar7's Slot Machine HD Pro
    By Danny in forum Android Released Games & Apps
    Replies: 0
    Last Post: 16th April 2014, 03:49 PM
  3. Slot Machine
    By MikeR in forum Android Export Module Version 2.0
    Replies: 0
    Last Post: 4th June 2011, 04:20 AM
  4. [Request]Select Object - Select in events?
    By LB in forum Extension Development
    Replies: 1
    Last Post: 15th July 2009, 11:55 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •