Replies: 1 comment
-
I personally prefer explicit. As a new contributor, I often find myself jumping between multiple classes to understand how things work. Having explicit references like "player" or "NPC" makes navigation easier and speeds up the process of adding content. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently context scripts use a mix of explicit character variables and implicit event variables in their scope. E.g.
player.inventory.remove(item.id)
rather thaninventory.remove(dropEvent.item.id)
.Currently a piece of player looks like:

But there's a strong argument to be made for a more implicit style where the player is not called directly.
This is shorter and simple to understand from a reading perspective but introduces ambiguity, for example, given the example above
Is
inventory
referring to the player's inventory or the inventory id in the InventoryOption event?It's not clear.
If both variables have the same name then even the compiler will warn about issues, this means that all variables would have to have distinct names within a shared scope.
Or how about: given a few lines in isolation, you don't know if it's being applied to a Player or an NPC without finding the top of the function it is located in.
RuneScript uses the implicit method and it seems to work, it's a tricky decision. It's hard to know without trying the alternative (implicit) which will be better, but switching will bring a lot change and risk so for now I'm putting my thoughts here and seeing what other people might think.
Which do you prefer? Explicit or implicit?
Beta Was this translation helpful? Give feedback.
All reactions