• Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    44
    ·
    2 months ago

    I was playing this really simple mobile phone game, where you basically go on these mining trips, then you tap the screen as quickly as possible. So, I thought to myself, I wonder if there’s a way to simulate screen taps, to tap at superhuman speeds.

    I found an app for that, this app had its own scripting language. Admittedly, there weren’t many concepts to learn in this language, but wait, there’s more.

    Then I thought, maybe I can also automate the menus, between the mining trips.
    But this language didn’t have support for multiple files, nor functions, you couldn’t even use labels in your goto statements, meaning my code started to get quite complicated.

    So, I actually sort of implemented support for goto labels / shitty functions within my program.

    Basically, at the start of the file, I had an if-else block, which read the value of a variable and based on that, it would select between different goto statements.
    So, if I wanted to “call a function”, I would set the variable to the function/label name and then goto 0.

    If I remember correctly, I did still need to manually update the line numbers in that lookup table at the start, but at least, I didn’t have to do it everywhere in the code anymore.

    And yes, I did manage to completely automate grinding that game, using this shitty scripting language.
    It was an offline game, and not a good one, I didn’t actually care about making progress in it. But scripting it was significantly more fun than playing it myself.

    • Luvon@beehaw.org
      link
      fedilink
      arrow-up
      5
      ·
      2 months ago

      There’s a game called something like “oh no the farmer is gone” which is about programming a little robot to harvest the fields and the programming is built directly into the game