• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Release] WurstScript - A Wurst to Jass Compiler & IDE

Status
Not open for further replies.

Deleted member 219079

D

Deleted member 219079

Okay now what's wrong with this??
attachment.php

How can I fix this
 

Attachments

  • asdf.png
    asdf.png
    31.5 KB · Views: 491
Hey, I was taking a look at this Wurstscript thing today, and was thinking it certainly looked interesting.

Usually I code in JASS (not something like vJASS) because I've been working on the Heaven's Fall mod that runs on a modified Blizzard.j game file. Included in Heaven's Fall, there's a library or two in Blizzard.j that I built in JASS by back-converting them from vJASS manually with the jasshelper.exe.

Does Wurstscript have anything useful like jasshelper.exe that could be used in a simple fashion to compile Wurst -> JASS outside of a map (then hook all initialization functions to one central function call?)? Map-centric technologies do not always work well for something designed as an alternative MPQ to overlay on top of melee games. Was wondering if I could consider using Wurstscript in modding.

(Side question: Did anybody ever write Wurst -> .ai code? That AI language is like nightmare JASS. The function "I2S" does not even work, in my experience, and produces random garbage strings from memory instead of converting an integer to a string.)
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
Version 1.5

Wurst now requires Java 8. Because of this compatibility change the version number was increased again.

Here are the changes since the last version:

Java 8

Wurst now requires Java 8. Download it here.
Language changes


  • operator overloading is now enabled for strings
  • @compiletime annotation is now allowed on static methods
  • new pseudo-native: callFunctionsWithAnnotation (check the hotdoc in MagicFunctions.wurst for documentation)
Tools


  • Added a warning for stupid assignments like this.x = x
  • Improved dataflow anomaly checker, gives warnings when a value is not used
  • Experimental compilation server for Wurstpack to make compiles faster (not documented yet and hard to use)
  • Eclipse can now do code-folding on imports
  • Improved error markers in eclipse
  • Autocomplete no longer triggers inside of comments or strings
Bugfixes:


  • fixed #216: Stdlib: ItemDefinition from UnitObjEditing.wurst creates units instead of items.
  • also fixed some bugs regarding object editing in the standard lib
  • fixed #277: Packages can import themselves, resulting in compiler bug
  • fixed #278: Unicode support
  • fixed #285: Multiline strings give no parse error
  • fixed #296: Underscore crashes Wc3
  • fixed a bug in jmpq library
  • fixed a bug in the translation of closures
  • hopefully fixed #26: Multiline comments were sometimes not highlighted correctly in eclipse
  • fixed a really bad bug in the optimizer (TempMerger)
  • fixed #280: extension functions with empty body were valid
  • fixed bug with empty switch statements
  • fixed a bug in the interpreter when handling ints/reals and overloading of natives
  • fixed a problem when starting a map from eclipse on certain Windows installations
  • fixed #310: cyclic class hierarchies

If you do not have Java 8 installed already, download it here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I would recommend uninstalling older Java versions first.

I hope no one has any trouble with updating Java, but since the release of Java 8 is now half a year ago, I thought it would be time to upgrade. It kind of felt strange to develop a language with closures in a language without closures :D
 
Level 8
Joined
Nov 20, 2011
Messages
202
Here is a prototype wurstscript archive which contains all you need to run wurstscript:
How to Install:
1. Download the archive here archive
2. Extract it to some location
3. Use the bat files to start the wurst components

Features:
-External Java 8 Runntime Enviroment (No Java required anymore)
-Preconfigured eclispe including all settings for a flawless experience
-134MB total archive size
-Ready to use sample workspace
-Compileserver starter
-Sample project setup
 

Deleted member 219079

D

Deleted member 219079

Been wondering, how do the abstract classes work? Do they use ExecuteFunc?

Because vJass uses ExecuteFunc/TriggerExecute for the "extends" stuff, which I find not efficient
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
Been wondering, how do the abstract classes work? Do they use ExecuteFunc?

Because vJass uses ExecuteFunc/TriggerExecute for the "extends" stuff, which I find not efficient

Wurst uses simple if-statements to implement the dynamic dispatch. It implements a binary search with the if-statements to make it efficient even when there is a large number of subclasses.
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
How does one load up someone else's map script with this?

I am not sure I understood the question correctly. So you have a map file and you want to look at the Wurst source code of the map? That is not possible, because only the compiled script is included in the map. The wurst sources are usually kept outside the map. But many maps put their Wurst code on github (for example HotN, more links in the first post).
 
Level 1
Joined
Sep 21, 2014
Messages
1
Save error

For some reason I am getting the below error every time I try and save. I most certainly have Java and have been using it for many years. The Eclipse plugin works fine and saves fine also. I have versions 1.7.0_55 and 1.8.0_20 of Java but I only use 1.8.0_20 (Java 8), is it possible that my earlier version is hindering the map from saving? Also is it possible to tell WurstWE.exe where to look for Java 8?

nojava.png
 
Level 23
Joined
Jan 1, 2009
Messages
1,610
For some reason I am getting the below error every time I try and save. I most certainly have Java and have been using it for many years. The Eclipse plugin works fine and saves fine also. I have versions 1.7.0_55 and 1.8.0_20 of Java but I only use 1.8.0_20 (Java 8), is it possible that my earlier version is hindering the map from saving? Also is it possible to tell WurstWE.exe where to look for Java 8?

View attachment 139465

Check google on JAVA_HOME.
It is in your enviroment variables and sets the homepath, probably still to 1.7

Alternatively you can always uninstall 7 and reinstall 8.
Also bes rue to have x64 and x86 when running x64 OS.
 
Level 8
Joined
Nov 20, 2011
Messages
202
For some reason I am getting the below error every time I try and save. I most certainly have Java and have been using it for many years. The Eclipse plugin works fine and saves fine also. I have versions 1.7.0_55 and 1.8.0_20 of Java but I only use 1.8.0_20 (Java 8), is it possible that my earlier version is hindering the map from saving? Also is it possible to tell WurstWE.exe where to look for Java 8?

View attachment 139465

There are know problems with the wurststarter and java 8. You can download the wurstscript archive which contains a portable version of the jre8.
You can also try to edit the startline in the wehack.lua to:
java -jar ./wurstscript/wurstscript.jar
 
Level 5
Joined
Dec 6, 2009
Messages
79
Okay, actually the path was correct, but I had to click the apply button in the preferences for it to work, you might wanna look into that.

Map is being created now, and game runs fine out of eclipse, although the map itself is not correct, I think, the config function in the compiled.j.txt is empty, so I get to the main menu when I'm trying to run it. Is there any solution to this?
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
> You are missing the war3map.j file i guess. You need to save the map with the we to generate it.

Nah I did that, war3map.j is in place (in the 'wurst' folder) and it's a correct default map code. wurstTestMap1.w3x contains the wrong one tho.

Can you see the war3map.j in eclipse? By default eclipse does not refresh changes on the filesystem automatically, so you have to refresh manually or change the preferences.

If this does not help either, then this is probably a bug. Are you using the latest version of the eclipse plugin?
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
Try to use "div" instead of "/"

Using div on vectors makes no sense, because vectors work with real numbers. So the operator overloading function should also be named op_divReal. Or just use multiplication sub = sub*(1/sub.length()) or the norm function from the standard library sub = sub.norm().

PS: we should change the operator overloading for division in the standard library.
 
Level 5
Joined
Dec 6, 2009
Messages
79
xodub

Alright, this construction just does not work properly with Stack/LinkedList and is entirely not possible with ArrayList. You might wanna look into that. I even had to check stack size before iterating it, because it would just give me NPE's all over the way.
Also are you for real? No "clear" method in LinkedList/Stack?

For now I'm forced to create secondary local (sic!) collection containing elements I have to remove from main list, which is a huge drawback. And even after this, destroying elements while iterating just breaks everything.
 
Level 5
Joined
Dec 6, 2009
Messages
79
qipit

Okay, this works with the array list (note how I had to code the loop manually, since 'for int i to size (or getSize())' just does not work properly). Destroying still messes things up.

Okay, in the end even DelayedDestroy does not seem to work.
Project is in the attachments. Try to put 'destroy spell' at the line 31, SpellControl.wurst and see the difference.
 

Attachments

  • arena.zip
    87.2 KB · Views: 54
Level 8
Joined
Nov 20, 2011
Messages
202
That are a lot of questions let me try to answer it:

zihyv

Incorrect indentation level
Seems like a bug to me

The code seems right. I would like to reproduce it, can you attach you project in some post?

pebyc

Ugh, really, and I was trying to find a mistake in my code. (Tip: "start.x, stop.y")

If you find bugs like that in the standardlibary you can send us a pull request on github: https://github.com/peq/WurstScript/edit/master/Wurstpack/wurstscript/lib/math/Interpolation.wurst

xodub

Alright, this construction just does not work properly with Stack/LinkedList and is entirely not possible with ArrayList. You might wanna look into that. I even had to check stack size before iterating it, because it would just give me NPE's all over the way.
Also are you for real? No "clear" method in LinkedList/Stack?

For now I'm forced to create secondary local (sic!) collection containing elements I have to remove from main list, which is a huge drawback. And even after this, destroying elements while iterating just breaks everything.

You could use just the for in loop and use spells.remove(spell)

qipit

Okay, this works with the array list (note how I had to code the loop manually, since 'for int i to size (or getSize())' just does not work properly). Destroying still messes things up.

Okay, in the end even DelayedDestroy does not seem to work.
Project is in the attachments. Try to put 'destroy spell' at the line 31, SpellControl.wurst and see the difference.

This is a realy ugly loop :eekani:
Well i took a look at you project and figured out the problem.
The list works fine your TestSpell.wurst has a bug.

The variable progress is never resetted. So if you destroy the object and create a new one the variable progress still contains the value 0.7, so the spell gets destroyed imediatly.

Here is a working version and a better looking loop:
http://www.hiveworkshop.com/forums/...wurstscript-wurst-jass-compiler-ide-arena.rar

Just btw if you have a lot of questions refering to wurst you can also join our irc: http://webchat.quakenet.org/?channels=#inwc.de-maps or add me in skype: Crigges
 

Attachments

  • arena.rar
    72.7 KB · Views: 61
Level 13
Joined
Mar 6, 2008
Messages
852
Gosh, DoctorGester, double posting is a no-go. There is an edit button in each post.
Also you should not make screenshots. Just copy your code and put it into jass tags (btw, are ther wurst tags already?).

If you have problems with your own code you can make a thread here.
You can post in this thread if you find a problem with wurst itself.

Nevertheless, welcome to the world of wurst!
 
Level 5
Joined
Dec 6, 2009
Messages
79
Alright guys, seems like I was wrong all along, tho resetting class members when creating a class instance is kinda meh. Thank you for helping me out, anyway! I was really confused by this behavior.

> The code seems right. I would like to reproduce it, can you attach you project in some post?
It's in the same project I attached, Hero.wurst, lines 162-166.

> You could use just the for in loop and use spells.remove(spell)
That's what I tried first and then it didn't work, so I thought I couldn't remove it while iterating just like in Java.

> This is a realy ugly loop
Well I kinda had to do that, because there is no iterator.remove() in arraylist, and if I used for int i = 0 to size, I had to put it under the conditional statement checking if size is more than 0.

Sorry for doubleposting and stuff.
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
I think I didn't implement a remove method for the arraylist iterator because it would not have been very efficient. Maybe it would be possible to do it efficiently when allowing inconsistent intermediate states while iterating. The easiest way is probably to have a for loop going down to zero, so that removing elements does not affect the loop.

Regarding the wrong indentation error : there actually is an open issue on github for that. The problem is that indentation is based on the beginning of the last statement, and not of the line with the "begin".
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
This looks really nice. Unfortunately a bit late where much vJass code does already exist. Is there any converter from vJass to Wurst or is it even possible to convert?

There is no tool to translate vJass to Wurst. There is a dialect of Wurst called Jurst, which has a very similar syntax to vJass, so adapting vJass libraries will be a bit faster. Also it is possible to use both vJass and Wurst in the same map, although the interaction between vJass and Wurst is kind of limited.
 
Level 23
Joined
Jan 1, 2009
Messages
1,610
Alright guys, seems like I was wrong all along, tho resetting class members when creating a class instance is kinda meh. Thank you for helping me out, anyway!

It's the same way it's in vJass, resetting all the members automatically makes no sense, simply choose proper initial values.

Also you should not make screenshots. Just copy your code and put it into jass tags (btw, are ther wurst tags already?).

Yes, for already half a year or more...
[code=wurst][/code]

Wurst:
class Barade extends FatAss
if(dmdf.eta() > 1 year)
    Barade.kill()
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
Will this has a Mac support or it's not supported for Mac?

The integeration with the World Editor will not work, because it is based on the Jass-New-Gen pack, which is Windows only.

Everything else should work with Mac. So, you can still use Wurst and compile everything from Eclipse or from the commandline. As it is written in Java it should work on any platform which supports Java 8. For example, I usually work with Ubuntu.


However, I don't have a Mac to test it.
 
Level 1
Joined
Jun 16, 2015
Messages
3
When creating an instance of class, I want to pass this value to another function.
Wurst:
construct(...,ThePlayer owner)
	owner.addBuilding(this)
But I get an error:
Wurst:
exprempty  cannot be used here. A full statement is required.
In vJass it can be done:
vJASS:
static method create takes ..., ThePlayer owner
local Building b = Building.allocate()
owner.addBuilding(b)
How to get an instance inside construct block and pass it to another function? in Wurst
 
Level 11
Joined
Mar 6, 2008
Messages
898
Hiho,

I would like to use WurstScript for a map I am planning to create.
However, I just wanted to ask for a certain feature which could enhance many script optimizations.
As far as I know you currently only allocate custom-types (class instances) on the "heap" with the new operator.
But what if I only need a certain instance in a local scope?
Wouldn't it be nice to introduce the legendary C++ RAII into the language where you can create those variables on the stack and which are automatically deleted by an automated call to their destructor at the end of the scope.
One then could implement optimizations so that those instances won't be allocated with the "new"-way but are placed into JASS local variables instead because their sizes are known at compile time.
The only downside of this is that one cannot use polymorphism when allocating an instance that way, but polymorphism isn't required everywhere and this technique could speed things up in general code and the language would give the programmer more controle over the code without loss of abstraction.

Regards,
Robbepop
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,537
Hiho,

I would like to use WurstScript for a map I am planning to create.
However, I just wanted to ask for a certain feature which could enhance many script optimizations.
As far as I know you currently only allocate custom-types (class instances) on the "heap" with the new operator.
But what if I only need a certain instance in a local scope?
Wouldn't it be nice to introduce the legendary C++ RAII into the language where you can create those variables on the stack and which are automatically deleted by an automated call to their destructor at the end of the scope.
One then could implement optimizations so that those instances won't be allocated with the "new"-way but are placed into JASS local variables instead because their sizes are known at compile time.
The only downside of this is that one cannot use polymorphism when allocating an instance that way, but polymorphism isn't required everywhere and this technique could speed things up in general code and the language would give the programmer more controle over the code without loss of abstraction.

Regards,
Robbepop

Have you seen tuple types? It might be good enough in this instance.
 
Status
Not open for further replies.
Top