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

Trying to use wc3 TypeScript Template

Status
Not open for further replies.
Level 12
Joined
Jan 30, 2020
Messages
875
Hello there !

I am trying to use @TriggerHappy 's TypeScript template for wc3.

First let me tell you that I am a complete newbie at TS, although I have already used JavaScript a while back.

So like any well-behaved newbie, I have followed the quick startup guide found at https://github.com/cipherxof/wc3-ts-template/wiki/1.-Getting-Started.

I installed latest version of node.js
As I never used Git before, I installed latest Git for windows from Git for Windows
Once everything seemed to be installed properly, I opened a PowerShell window as an admin.

- Then i went to my users folder "C:\Users\Macadamia".
- Then I typed :
Code:
git clone https://github.com/triggerhappy187/wc3-ts-template.git
cd wc3-ts-template
it went pretty well.
- Next I typed "npm install" and it updated successfully.

Once done I edited "tsconfig.json" according to my local folders :
Code:
{
  "mapFolder": ".\maps\map.w3x",
  "minifyScript": false,
  "gameExecutable": "‪J:\Jeux\Warcraft III\x86_64\Warcraft III.exe",
  "outputFolder": "./dist/bin",
  "launchArgs": [
    "-launch",
    "-windowmode",
    "windowed"
  ]
}

- Then I tried to run "npm run build", and that is where it fails :
Code:
> [email protected] build C:\Users\Macadamia\wc3-ts-template
> ts-node --ignore "node_modules/(?!mdx-m3-viewer).*" scripts/build.ts

[2020-05-16 18:03:41] error: SyntaxError: Unexpected token m in JSON at position 24
[2020-05-16 18:03:41] error: Could not find key "mapFolder" in config.json
[2020-05-16 18:03:41] error: Failed to compile map.
PS C:\Users\Macadamia\wc3-ts-template>

So the question is : where did I mess up ?
Thanks, and take care !


EDIT : Ok one blame for me, so I replaced folder separators with "/" and changed the mapFolder back to just "map.w3x"

Being a noob at something really sucks :D

EDIT 2 : Nearly there.

Here is my tsconfig.json now :
Code:
{
  "mapFolder": "map.w3x",
  "minifyScript": false,
  "gameExecutable": "‪J:/Jeux/Warcraft III/x86_64/Warcraft III.exe",
  "outputFolder": "./dist/bin",
  "launchArgs": [
    "-launch",
    "-windowmode",
    "windowed"
  ]
}

This is definitely the right path for wc3 executable ("‪J:\Jeux\Warcraft III\x86_64\Warcraft III.exe" on windows)

But when I try "npm run test", I end up with :

Code:
> [email protected] test C:\Users\Macadamia\wc3-ts-template
> ts-node scripts/test.ts

[2020-05-16 18:29:02] info: Transpiling TypeScript to Lua...
[2020-05-16 18:29:05] info: Building "map.w3x"...
[2020-05-16 18:29:05] info: Launching map "C:/Users/Macadamia/wc3-ts-template/dist/map.w3x"...
[2020-05-16 18:29:05] error: No such file or directory "‪J:/Jeux/Warcraft III/x86_64/Warcraft III.exe". Make sure gameExecutable is configured properly in config.json.
PS C:\Users\Macadamia\wc3-ts-template>

What is wrong with my wc3 folder ?
 
Last edited:
Level 12
Joined
Jan 30, 2020
Messages
875
Thanks, I will try that as soon as the neverending build of HiveWE finishes :D
Not even sure the current version on GitHub is any close to 0.7 or even supports Lua or Reforged, just needed to test it to manually alter pathing.

Anyways, thanks, this should solve my problem, and I should soon be able to learn TS and try to use it for wc3 !!!!
Not going to convert my current project, but I want to get rid of the lack of type safety from Lua that gives me endless nightmares and some errors that I end up only catching by accident :D

EDIT : hadn't noticed "minifyScript" entry, does it do what it looks like ?

EDIT 2
: Unfortunately it didn't work :
Code:
{
  "mapFolder": "map.w3x",
  "minifyScript": false,
  "gameExecutable": "‪J:\\Jeux\\Warcraft III\\x86_64\\Warcraft III.exe",
  "outputFolder": "./dist/bin",
  "launchArgs": [
    "-launch",
    "-windowmode",
    "windowed"
  ]
}

Code:
PS C:\Users\Macadamia\wc3-ts-template> npm run test

> [email protected] test C:\Users\Macadamia\wc3-ts-template
> ts-node scripts/test.ts

[2020-05-17 15:02:37] info: Transpiling TypeScript to Lua...
[2020-05-17 15:02:40] info: Building "map.w3x"...
[2020-05-17 15:02:40] info: Launching map "C:/Users/Macadamia/wc3-ts-template/dist/map.w3x"...
[2020-05-17 15:02:40] error: No such file or directory "‪J:\Jeux\Warcraft III\x86_64\Warcraft III.exe". Make sure gameExecutable is configured properly in config.json.
PS C:\Users\Macadamia\wc3-ts-template>
 
Last edited:
Status
Not open for further replies.
Top