Results 1 to 11 of 11

Topic: Reducing Byte Size

  1. #1
    The GPC Godfather



    User Info Menu

    Reducing Byte Size

    As most of you know the maximum bytes size limit for a script is 4096. I'm always looking for more efficient/smaller (bytes size) ways of coding. A lot can be accomplished within the 4096 limit, but if you're not careful it can be reached pretty quickly -- leaving you with features you still want to add. That's why regardless of how big I think a script may be, I start out using the most stream-lined code I know. There's been a number of times a small script with only a couple of feature developed into a large full-blown script. Efficient coding from the start avoids having to go back and re-write sections of your script, trying squeeze out a few more bytes.

    Here's a few tips to save bytes and a couple of commonly used features in scripts. The scripts are as small as I can figure out. If you have other tips or a better way of coding, please post.

    TIP



    • combos - A combo definition uses roughly 79 bytes by itself without any additional coding. The power of a combo is wait(). If what your trying to accomplished doesn't require the use of wait(), consider putting the code in the main {}. Don't forget the main {} is just a big loop, executed sequentially from top to bottom every 10 milliseconds. Also you can use the iteration cycle of the main{} as a timer (see scripts below) instead of a combo and wait();


    • get_rtime() returns the time between the previous and the current iterations of the main {}. This value will always be 10 unless using vm_tctrl();

    <variable> += get_rtime();
    Uses 2 less bytes than
    <variable> += 10;

    • Use define when the value assigned will not be changed during the script (constant)

    define CONSTANT = 1;
    Uses 8 less bytes than
    int variable = 1;






  2. The Following 9 Users Say Thank You to Batts For This Useful Post:


  3. #2
    Community Boss

    User Info Menu

    Re: Reducing Byte Size

    This deserves to be sticky. Well done!!

  4. #3
    Support Staff

    User Info Menu

    Re: Reducing Byte Size

    Sweet! I usually don't need to worry about bytesize but since its so easy to get its worth doing.

  5. #4
    The GPC Godfather



    User Info Menu

    Re: Reducing Byte Size

    Anti Recoil - vertical and horizontal added to the list (89 bytes).

    Aim Assist - basic pattern (192 bytes).

  6. The Following User Says Thank You to Batts For This Useful Post:


  7. #5
    Script Support


    User Info Menu

    Re: Reducing Byte Size

    Quote Originally Posted by MaxADMIN View Post
    This deserves to be sticky. Well done!!
    BATTS is a genius when it comes to this. Whenever I get stuck or really need to reduce size, BATTS is my person to go to...

    Batts a.k.a. "THE Code Reducer"

  8. The Following User Says Thank You to Crescens For This Useful Post:


  9. #6
    MASTER GUARDIAN I

    User Info Menu

    Re: Reducing Byte Size

    congratulations

  10. #7
    Script Support


    User Info Menu

    Re: Reducing Byte Size

    Yo Batts,

    Did you already do your research?

    114 Bytes, must be the shortest way to reduce code in the case you have multiple btn combinations that share the same start btn....




    HA, 60 bytes (with two btns hold), instead of 114 bytes with one btn:


  11. #8
    The GPC Godfather



    User Info Menu

    Re: Reducing Byte Size

    Quote Originally Posted by Crescens View Post
    Yo Batts,

    Did you already do your research?

    114 Bytes, must be the shortest way to reduce code in the case you have multiple btn combinations that share the same start btn....




    HA, 60 bytes (with two btns hold), instead of 114 bytes with one btn:

    Nice job. I'm not sure what you're talking about. I didn't write either one of those

  12. #9
    Script Support


    User Info Menu

    Re: Reducing Byte Size

    Never mind, all that counts.... 60 bytes


    Yeah.....

    Have you got any clue HOW MUCH space I just saved in my upcoming script that you are going to help me write....hahahahaha !

  13. The Following User Says Thank You to Crescens For This Useful Post:


  14. #10
    Senior Support Staff


    User Info Menu

    Re: Reducing Byte Size

    IDK if we can save some bytes if we use multiple double tap by using a function




    EDIT
    5 differents double tap command in the script are necessary to save some bytes
    4 differents double tap command in the script = same byte size as 4 double tap command without function()
    3 differents double tap command in the script is not profitable with function()

  15. The Following 2 Users Say Thank You to noozbar For This Useful Post:


  16. #11
    The GPC Godfather



    User Info Menu

    Re: Reducing Byte Size

    Quote Originally Posted by noozbar View Post
    IDK if we can save some bytes if we use multiple double tap by using a function




    EDIT
    5 differents double tap command are necessary to save some bytes
    4 differents double tap command = same byte size as 4 times without function
    3 differents t's not profitable
    I would have to do some testing to see
    My internet is down at the moment. Hard to do much on my phone. My fat thumbs don't work well on this keyboard.

Posting Permissions

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