User Tag List

Results 1 to 6 of 6

Thread: Easier way to perform these functions?

  1. #1
    Clicker Fusion 2.5 (Steam)

    Join Date
    Jan 2015
    Location
    Central Oregon, USA
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Easier way to perform these functions?

    Hi guys. So I'm currently playing around with how to do various things. Right now it's an 8-player turn based system, I'm trying to figure out a decent way to do turn priority.

    As it stands now, it works exactly as I want it to, but the problem is, it's 163 events long. I'm hoping there's some way to condence it. Here's how it currently works.

    The system is dependant on 26 different values:

    A1, B1, C1
    A2, B2, C2
    A3, B3, C3
    A4, B4, C4
    A5, B5, C5
    A6, B6, C6
    A7, B7, C7
    A8, B8, C8.
    D1, D2

    A and B are the important values here. A is the turn order. When it's determined, they're each assigned a value between 1 and 8. Which value each A is assigned is dependant on the B values, which are different depending on that that player is going to do. A is default set to one, then when the B values are compared, A adds 1 to it's value for every B value thats LOWER than it's own B value.

    coding example:

    If B1 < B2, +1 To A1
    -----
    If B1 < B3, +1 To A1
    -----
    Repeat for every combination for a total of 49 events.



    If two B values are the same, then it looks at the C value, which is each players speed stat. It will look at which ever is lower, and add 1 to the lower one's A value.

    Coding Example
    If B1 = B2 AND C1 < C2, +1 to A1
    -----
    If B1 = B2 AND C2 > C1, +1 to A2

    Again, repeat for every combination of slots. Once for X being higher and once for Y being higher, for a total of 56 events.


    But then there's the rare chance that both the B AND C values are the same, and there's where the D values come in. The D values are randomized each time the calculations start. Also, if D1 = D2, Randomize again, so they can't land on the same value. Thats two events are there, and, you guessed it Lower one is the winner.

    Coding example
    If B1 = B2 AND C1 = C2 AND D1 > D2, +1 to A1
    If B1 = B2 AND C1 = C2 AND D2 > D1, +1 to A2.

    Again, repeat for every possible combo, for another 56 Events.


    Grand total event count: 163.

    I've been playing around a bit but I can't seem to figure out a means to condense this. Anyone have any ideas? After learning about the 20,000 event limit I'm trying to get everything as small as possible.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Uh, that must have been a huge headache to code

    I'd say It would be better finding other solutions not much for the event limit,
    as for the code inspecting-change that you may have to do later... that would be really distressing!


    From a quick glance, this seems to be a good work for nested loops.

    Ex.


    If B1 < B2, +1 To A1
    -----
    If B1 < B3, +1 To A1


    becomes:

    (let's say your values are stored like

    id0 A1
    id1 A2
    id2 A3
    ....
    id8 B1
    id9 B2
    id10 B3
    ....)


    on "turn check" event
    ---> start loop "A_ check" 8 times

    on loop "A_check"
    ---> start loop "b_check" 8 times

    on loop "B_check"
    +compare 2 general values:: select value by index 8+(loopindex A_check) < 8+(loopindex B_check)
    ---> add 1 to :: select value by index (loopindex A_check)

    as a general idea... to be properly setup basing on your value system.


    Also, have you considered setting up a different turn system?

  3. #3
    Clicker Fusion 2.5 (Steam)

    Join Date
    Jan 2015
    Location
    Central Oregon, USA
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've heard the term Nested loop and Fastloop thrown around here but I have NO clue how to do those. Looks like it's time to find out.

    Question though, the way you have it described, it sounds like I would need all the values stored in one place, like the Gobal values or a single active's Alt values. That would be find for A and B but the C values I have stored in different global actives I'm using as valuebanks for each character. Would the Loops work for such a scenario?

    As for a different system, Yeah I'm looking into making it a bit less complicated. I'm thinking of eliminating the A values and just using B as the final factor, but there's still the tiebreaking stuff to deal with

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    You'll definitely have to take a look at loops
    Loops are just events triggered by a starting event, and repeated how many times you want.
    Nested loops are loops launched within other loops.

    On event xxxx ---> ("special" icon) start loop (give it a name) (number of times)

    ("special" icon) on loop "your loop name" ---> do stuff (use loopindex("loopname") to get current loop index number)


    If you have values stored in different actives (say, your players)
    things get a little more tricky, but still doable,
    you'll probably have to take a look at "foreach loops",
    that are loops performed "on each object of same kind"

  5. #5
    Clicker Fusion 2.5 Developer

    Join Date
    Feb 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I like these challenges! I have made an example file solving the problem using nested loops. It could probably have been done more elegantly, but it's shorter than 163 events.

    Fusion 2.5, no extensions.
    daft_sorting.mfa

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Wow, that's cool

Similar Threads

  1. Softkeyboard: perform action when Done key is pressed
    By Bipolar_Games in forum Android Export Module Version 2.0
    Replies: 3
    Last Post: 15th January 2014, 03:09 AM
  2. Good way to perform searches on remote documents?
    By RGBreality in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 15th October 2010, 05:22 PM
  3. Easier way? : edit box = A or B or C etc
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 17th December 2008, 01:05 AM
  4. Is there an easier way than this?
    By maestro1 in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 1st March 2008, 06:49 AM
  5. How to combinate two keys to perform actions?
    By The Thinker in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 8th November 2006, 11:19 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
  •