[Solved?] Labels and spaghetti code

● ARCHIVED · READ-ONLY
Started by FoxySeta 6 posts View original ↗
  1. This is kinda of an "eventing" (how is it called outside RPG Maker?:kaoswt2:) style question, but when are you actually supposed to prefer labels over conditions/loops scene commands?

    In high-level programming, for example, goto should be used only when:
    • a program automatically generates code (ex. parser generators)
    • exiting from nested loops
    I understand how "eventing" is somewhat different, but I'd appreciate some stylistic guidelines to event good scenes.

    I also tried checking VNM's guide, but here's all I found:
    • 2017-01-30_13-10-13.jpg
    • 2017-01-30_13-04-09.jpg
  2. Jump to label is quite rare to be used, because the only time when it's more usable than loop is when you need to jump forward in the code instead of looping the code.
  3. Labels are good when you really need to jump around the code a lot or to a far far part of the code (which if you do via conditionals would cause you to copy paste a lot of codes making conditionals inefficient), but in my so many years of using RM products, I rarely used that function..
  4. I used a label structure to create subroutines on an event, which can't account for them.
    program goes in, literally runs the command "go to label xxxxx" as a script call ("xxxxx" being dynamic, changes according to the game), runs the event, goes back right after the script call, exits the main loop.
    I didn't want to bother making hundreds of independent common events that would all run the-same-thing-but-not-quite, so I packed them all into the same event through labels.

    the system didn't merit it's own plugin, hence the complex eventing.

    the whole system is basically a manager: you send it one piece of data, the event does all the processing, and returns, independent from the main program.
  5. Poryg said:
    Jump to label is quite rare to be used, because the only time when it's more usable than loop is when you need to jump forward in the code instead of looping the code.
    What about conditions?
    Engr. Adiktuzmiko said:
    Labels are good when you really need to jump around the code a lot or to a far far part of the code (which if you do via conditionals would cause you to copy paste a lot of codes making conditionals inefficient), but in my so many years of using RM products, I rarely used that function..
    Oh I see here come conditions:kaophew:

    Thanks! (I just hope it's the same with VNM)
  6. I still like using the loops even with conditions, because it keeps cleaner code - I don't have to worry about processing more than I wanted to by accident.