1. Choose the best Old Gods themed skin at the Texturing Contest #29 - Poll!
    Dismiss Notice
  2. Melee Mapping Contest #2 - Poll is up! Vote for the best competitive 1v1 map!
    Dismiss Notice
  3. Please help test custom maps and more on the latest PTR!
    Dismiss Notice
  4. Evolution complete! Make Darwin proud and go vote in the Techtree Contest #12 - Poll.
    Dismiss Notice
  5. Icon Contest #17 - Results are out! Step by to congratulate our winners!
    Dismiss Notice
  6. We've created the Staff Job Openings thread. We're currently in need of icon, video production, and social/multimedia positions to be filled. Thank you!
    Dismiss Notice

Best of the Wurst 6

Discussion in 'Latest Updates and News' started by Frotty, May 17, 2018.

  1. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,253
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    [​IMG]
    Wurst goes 1.29 and beyond

    As the new patch has hit earlier in April, we have implemented the necessary changes to support it in our toolchain, while still keeping backwards compatibility alive.

    Updates
    • Increased maximum class instances to 32768 to match new array sizes in 1.29+
    • The new common.j and blizzard.j are now supplied by default
    • Implemented vararg function parameters - functions that take a variable amount of parameters of a certain type.
    • VSCode highlighting has been improved to match the language documentation, recognizing punctuation and operators
    • Deprecation warnings now also show for variables
    • Fixed two unusual exceptions related to extended unicode characters
    • Implemented additional natives for compiletime such as timers, triggers, rects and more, enabling those to be used in unit tests.
    • Modified standard units get printed into
      WurstExportedObjects
      again, for easier transfer to generated objects
    • The operator precedence of
      or
      in Wursts Jass parsing is now correct
    Standard Library
    • Merged over 10 awesome pull requests regarding object editing, damage detection and the new Blz natives
    • Extension function wrappers for the new natives, such as effect.setColor and item.setName have been added
    • Packages affected by the new 24 player capability, such as Colors, have been updated accordingly
    • Fixed and unit tested several issues with typecasting and error handling
     
  2. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,253
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    Variable Argument Functions

    Wurst now supports a limited variant of variable argument functions. Variable arguments can only be iterated over and not directly accessed, neither the amount.

    Declaration:
    Code (WurstScript):
    function sum(vararg int ints)
        var result = 0
        for i in ints
            result += i
        print(result.toString())
     
    Usage:
    Code (WurstScript):
    sum(1,2,3,4)
    sum(14,22)
    sum(23,52,5234,5,5)
     
    Several functions in the standard library are now implemented via varargs, and as such, offer variable argument functionality, for example id-lists for object editing and groups:
    Code (WurstScript):
    @compiletime function genBuilder()
        new UnitObjDefinition('buil', 'hfoo')
        ..setNormalAbilities(asList(ID_FIREBALL, ID_FIRE_NOVA))
        ..setStructuresBuilt(asList(ID_GUARD_TOWER, ID_CANNON_TOWER))

    init
        CreateGroup().addUnit(u1, u2, u3)
    Additionally
    asList
    is now available to inline create LinkedLists of elements
    Code (WurstScript):
    asList("This", "will", "be", "a", "list")
    asList(75., 125., 175.).add(250., 375.)
    asList(players[0], players[1], players[2], players[3])
    Protips

    Want to be most efficient with wurst? Under the 'Protip' slogan we will regularly feature ways or products to improve your workflow:

    • Use Vector Tuples
      Instead of working with either locations, which leak and shouldn't be used, or x and y coordinates, which doubles the amount of code you have to write and the amount of mistakes you can make, Wurst provides
      vec2
      and
      vec3
      vector tuples which, unlike classes, don't have an identity and therefore are translated with zero overhead. This means you get the speed of using coordinates directly, but the comfort of class-like syntax and functionality. Some common uses:
      Code (WurstScript):

      // Event response
      getSpellTargetPos() // instead of GetSpellTargetX/Y
      getOrderPos() // instead of GetOrderPointX/Y
      getOrderTargetPos()  // instead of GetWidgetX(GetOrderTarget()) etc.

      // As class member, e.g. position, velocity
      class A
          vec2 position

      // Angle between points & Polar projection
      function onEvent()
          let casterPos = GetTriggerUnit().getPos()
          let angl = casterPos.angleTo(getSpellTargetPos())
          flashEffect(Objects.impaleTargetDust, casterPos.polarOffset(angl, 256.))
      You will notice that many extension functions also expect vector tuples as arguments, making them even more seamless to use.

    • VSCode extension: vscode-icons
      Adds meaningful icons to the folder tree view, improving visual recognition and fidelity. Wurst code files don't get recognized yet, but most other files do, which helps to distinguish them.
      [​IMG]

      Cheers
      Frotty
     
    Last edited: May 17, 2018
  3. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,225
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    New functionality is awesome. Not so sure I like the vararg syntax but... that is minor
     
  4. karlek

    karlek

    Joined:
    Dec 31, 2017
    Messages:
    8
    Resources:
    0
    Resources:
    0
    Trivia: The motivation was that it's easier to search and ask about a function signature with vararg keyword written in it. Since the programming experience in the mapping community is wildly varied.
     
  5. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    762
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    Is it possible to use WurstScript on linux with a wine installation of Wc3?
     
  6. karlek

    karlek

    Joined:
    Dec 31, 2017
    Messages:
    8
    Resources:
    0
    Resources:
    0
  7. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,027
    Resources:
    2
    Models:
    1
    Icons:
    1
    Resources:
    2
    Looks like this took a while to get to the front page :p
     
  8. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,253
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    Well it was one :)

    Yes, and you can also use it without wine/wc3 if you just want to develop and build, but not run the map. But you need to supply the "-noPJass" arg.
     
    Last edited: May 23, 2018
  9. Duke

    Duke

    Joined:
    Nov 23, 2006
    Messages:
    480
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Definitely want to learn Wurst. Can it be used in campaign maps, and if not, is there a possbility that it will in future?
     
  10. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,085
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    Yay! I love KieĊ‚basa : D
     
  11. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,253
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    I don't see why not. But we don't support building campaigns yet, which you would need to do manually. I might look into that.
     
  12. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    762
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    Oh, wow - works like a charm! Though, I didnt need to add -noPjass (I'm guessing its on by default)
     
  13. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,253
    Resources:
    9
    Models:
    3
    Tools:
    1
    Maps:
    3
    Tutorials:
    1
    Wurst:
    1
    Resources:
    9
    Great to hear :thumbs_up:
    The normal editor will work - but no, noPJass is not default, pjass is only executed on run/build and if the .exe cannot be run, you should get an error, or at least some message in the Output->wurstlangServer tab.
    If you have wine installed, it will automatically be used to runn pjass.
     
  14. BlueSaint

    BlueSaint

    Joined:
    Jun 18, 2012
    Messages:
    2,652
    Resources:
    3
    Tools:
    1
    Spells:
    2
    Resources:
    3
    Variadic arguments in JASS, damn :D

    Nice work, as always
     
  15. pandes

    pandes

    Joined:
    Jul 14, 2018
    Messages:
    1
    Resources:
    0
    Resources:
    0
    Loving this thread!