Skript

Skript

743k Downloads

Builder Pattern but skripty

7othifaPS opened this issue ยท 6 comments

commented

Suggestion

Adding a new functions system would be cool like createArea("hello", loc1, loc2).setLogo(item).setDescription("hello to my area")

with the coding format

function createArea(name: string, loc1: location, loc2: location):
  set {-areas::loc1::%{_name}%} to {_loc1}
  set {-areas::loc2::%{_name}%} to {_loc2}
  function setLogo(logo: item):
    #whatever code

can have better names/formats

Why?

I feel it makes it easier than having 100 parameters and make it understandable/readable :D

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
commented

builder format stuff would likely fall under Sections and their entry nodes the issue is there's no real use in it nor an actual decent way to implement it without it just being a normal function call but longer.

commented

but i think it would be used by advanced skripters at least, because beginners wouldn't even think of that, but only if they check docs

commented

builder format stuff would likely fall under Sections and their entry nodes the issue is there's no real use in it nor an actual decent way to implement it without it just being a normal function call but longer.

"no real use" yeah maybe in skript I guess? But I'd probably use it but I would prefer if you could do something like this which I don't believe it's easy to do

set {_x} to createX()
  .setX(x)
  .setY(y)

I'd assume it be difficult to parse

Reason: just looks cleaner I guess

commented

but i think it would be used by advanced skripters at least, because beginners wouldn't even think of that, but only if they check docs

Any chance you can grant an example that doesn't use .blah without it basically being a function

commented

Skript is a an English friendly scripting language thus the suggested idea & pattern doesn't match the language rules.

commented

in addition to what Ayham said, I think it's important that features intended for advanced users are still readable for beginners who may need to edit an advanced script. we don't want to leave them in the dust - even if they don't understand the concepts, they should be able to understand the words and symbols involved.