1. #21

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    Originally Posted by JaminBen007
    Originally Posted by P4INKiller
    Modulo:
    Represented as mod or % in most programming languages.
    I guess it's simple to explain what it does, but it's harder to explain why it's useful.

    It's basically division.
    It divides the first value by the second value, but you get the remainder of the division rather than the result.

    If I divide 16 by 5 I get 3.2 (16 / 5 = 3.2).
    But what if we are only allowed to divide whole numbers and not fractions?
    We would only be able to divide by 4, and we would get a remainder of 1 (16 % 5 = 1).

    Modulo is very useful for a number of reasons, like making a clock for instance!
    Place a Two-Input operator and change its operation to Modulo, then change the second value to something like 10.
    Now notice what happens with the output as you increase the first value and go beyond 10.

    It resets to zero every ten increments!
    This is very useful if you need a repeating number, this way you won't have to use a generic filter to see if a number has gone beyond a certain threshold and reset it with a set value event.
    I want to thank you for this one, it works really well for use in a cursor/menu system. I used the modulo function to store the number of menu choices and used a multiple of the modulo number to get the distance on the x axis the cursor needs to move to get to the next menu item.

    I also duplicated it with the Z axis to form a very effective grid system that uses the two modulo numbers as co-ordinates to read which item the cursor is over. It's far simpler than any other menu/cursor system I have seen as it only needs 8 tiles for a menu, or 16 for a grid system!
    a 1button cycle menu takes 5 tiles

    a button, 1 generic filter, 2 set events and a vds
    Share this post

  2. #22

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    a 1button cycle menu takes 5 tiles

    a button, 1 generic filter, 2 set events and a vds
    You forgot the OPE

    And I like two buttons
    Share this post

  3. #23

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    you don't need an ope for a menu though
    and a modulo can be replaced with a set event

    you gave me a good idea though for useing a cursor for visualising the menu
    Share this post

  4. #24

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    Originally Posted by sparkierjonesz
    you don't need an ope for a menu though
    and a modulo can be replaced with a set event

    you gave me a good idea though for useing a cursor for visualising the menu
    Well, you don't "need" an OPE, but you need to illustrate which option on a menu you have highlighted, so either way you will need more tiles.

    Do you have an easier way than using an OPE on a cursor?
    Share this post

  5. #25

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    Originally Posted by JaminBen007
    Originally Posted by sparkierjonesz
    you don't need an ope for a menu though
    and a modulo can be replaced with a set event

    you gave me a good idea though for useing a cursor for visualising the menu
    Well, you don't "need" an OPE, but you need to illustrate which option on a menu you have highlighted, so either way you will need more tiles.

    Do you have an easier way than using an OPE on a cursor?
    i used some visibility events to show what changed but sadly my game wasn't noob friendly enough
    i should have hidden the way i coded stuff behind menu screens etc
    Share this post

  6. #26

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    Originally Posted by sparkierjonesz
    Originally Posted by JaminBen007
    Originally Posted by sparkierjonesz
    you don't need an ope for a menu though
    and a modulo can be replaced with a set event

    you gave me a good idea though for useing a cursor for visualising the menu
    Well, you don't "need" an OPE, but you need to illustrate which option on a menu you have highlighted, so either way you will need more tiles.

    Do you have an easier way than using an OPE on a cursor?
    i used some visibility events to show what changed but sadly my game wasn't noob friendly enough
    i should have hidden the way i coded stuff behind menu screens etc
    Aha! See, more than 5 tiles needed.

    I used LB and RB buttons to set value events to increase and decrease a VDS by 1. The VDS is value 1 in the Modulo, value 2 is number of menu choices. Then the Modulo goes through a two input operator to multiply it by the distance between menu choices which in turn is the X axis for an OPE that moves a cursor. Feed the impulses to the OPE from the two SVEs and you're done. 8 tiles total.
    Share this post

  7. #27

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    there are many ways to visualise stuff

    altough the ope one you have will probably be the most complexity friendly
    Share this post

  8. #28
    LukeMSki's Avatar Senior Member
    Join Date
    Mar 2014
    Posts
    1,326

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    Originally Posted by JaminBen007
    I want to thank you for this one, it works really well for use in a cursor/menu system. I used the modulo function to store the number of menu choices and used a multiple of the modulo number to get the distance on the x axis the cursor needs to move to get to the next menu item.

    I also duplicated it with the Z axis to form a very effective grid system that uses the two modulo numbers as co-ordinates to read which item the cursor is over. It's far simpler than any other menu/cursor system I have seen as it only needs 8 tiles for a menu, or 16 for a grid system!
    Hey Jamin, could you explain how this would work as a cursor that can know which section it is over. Similar to what I was asking about in my Cursor thread.
    Share this post

  9. #29

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    Yeah sure. I did a tutorial in the Visual Tutorial thread for the single axis menu.

    To form a grid you just do it twice, once for the X axis and one for the Z axis (or Y if you prefer).

    Then it takes a bit more work with filters so the game knows where the cursor is but nothing too hard. I'll draw up another tutorial for the grid system if its easier to explain that way.
    Share this post

  10. #30
    LukeMSki's Avatar Senior Member
    Join Date
    Mar 2014
    Posts
    1,326

    Re: P4INKiller's HOUSE OF HEADACHES (Editor Math Tutorials)

    Originally Posted by JaminBen007
    Yeah sure. I did a tutorial in the Visual Tutorial thread for the single axis menu.

    To form a grid you just do it twice, once for the X axis and one for the Z axis (or Y if you prefer).

    Then it takes a bit more work with filters so the game knows where the cursor is but nothing too hard. I'll draw up another tutorial for the grid system if its easier to explain that way.
    If you could do that quickly, that would be great.
    Share this post