• 🏆 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!

JHCR setup with Wurst

Status
Not open for further replies.
Level 2
Joined
May 4, 2014
Messages
6
Hello Hive Workshop, first-time poster here.

I recently got back to wc3 map making and found out about Wurst, which made me really happy. I've managed to set up the starting project and can edit a few things. However, I cannot get hot reloading to work with JHCR. I've followed the Wurst hot reloading guide over here: WurstScript • Hot Code Reload Guide.

When running the game from VSCode using the "Run a Wurst map with Jass Hot Code Reload (JHCR)", adding another print statement in the init method of my one package, updating the code with "Reload code for a Wurst map start with Jass Hot Code Reload (JHCR)", and finally hitting Esc in the game, all I get is "Code reloaded!" in the chat, but not my new, nor old print statements.

Have I completely misunderstood the purpose/usage of JHCR or is something weird going on?

Thanks in advance!

Sincerely, a beginner.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
It would help if you posted the code before and after you reloaded it.
 
Level 2
Joined
May 4, 2014
Messages
6
Before

wurst/Hello.wurst
Code:
package Hello

init
    print("Hello")

and after

wurst/Hello.wurst
Code:
package Hello

init
    print("Hello")
    print("World")
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
Before

wurst/Hello.wurst
Code:
package Hello

init
    print("Hello")

and after

wurst/Hello.wurst
Code:
package Hello

init
    print("Hello")
    print("World")
Well init is never executed again, so it's reasonable that nothing is printed.
 
Level 2
Joined
May 4, 2014
Messages
6
Thanks, that's what I suspected. What code could be hot reloaded? Code that's run on certain actions?
 
Level 2
Joined
May 4, 2014
Messages
6
So I tried the following, but still can't get it to work. It's probably just me who's not getting the hang of it, so I appreciate the help.

Before
Code:
package Hello

import DamageDetection
import UnitIds

init
    createUnit(localPlayer, UnitIds.archer, vec2(100, 100), angle(0))
    addOnDamageFunc() ->
        custom_func()

function custom_func()
    print("Damage Event with dmg: " + GetEventDamage().toString())

After
Code:
package Hello

import DamageDetection
import UnitIds

init
    createUnit(localPlayer, UnitIds.archer, vec2(100, 100), angle(0))
    addOnDamageFunc() ->
        custom_func()

function custom_func()
    print("Damage Event with dmg: " + GetEventDamage().toString())        
    print("Hey")

The on damage message does not appear to be updated. I tried the same with

Code:
init
    doPeriodically(0.5) cb ->
        print("Something")

But changing the print message didn't change anything either
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
It *should* work :) Guess i will have to investigate, maybe on the weekend.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
I have updated jhcr. It should work now after you re-downloaded jhcr.
 
Level 2
Joined
May 4, 2014
Messages
6
I have updated jhcr. It should work now after you re-downloaded jhcr.
Amazing, now it works!

One more question, I read in the beginner guide that there is the .jurst extension as well, which is for curly bracket syntax? However, I cannot find any information on this in the manual or anywhere else. Is this discontinued or just lacking documentation? Coming from languages that use this kind of syntax, which I myself prefer, it'd be pretty nice if it already existed
 
Level 23
Joined
Jan 1, 2009
Messages
1,610
One more question, I read in the beginner guide that there is the .jurst extension as well, which is for curly bracket syntax?

No, you misread. The jurst syntax is more closely related to Jass, using verbose keywords to end blocks.
If you are used to curly braces, wurst is super easy: just leave them out! It should be the only difference.
 
Status
Not open for further replies.
Top