• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[LUA] How to get map's filename?

Status
Not open for further replies.
Level 31
Joined
Jul 10, 2007
Messages
6,306
Anyone know how?

/sad face at
//! externalblock extension=lua ObjectMerger $FILENAME$

the name of the file is passed in, but don't know how to access /cry.

I already tried $FILENAME$ : (.

edit
Tried debug.getinfo(1).source.

From this I learned that external blocks create a temp file in the Temp directory and write the lua script into that (never deletes them mind you!).

So it the debug outputted VC21E.tmp.lua /cry.

Also, using external block seems to create like 6 temp files every time it is used, and these tmp files just pile up in the Temp directory and never ever get deleted >.>.

Anyways, on the subject, I currently see no way to get the currently saving map's filename : |.

What I am now thinking of is going into the trigger strings and retrieving the map's game name via FileExporter and regex ;D.
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
Figured out a way to do it.

This is within the war3map.wtg file of the Learn StringParser map
Code:
WTG!         Learn         String Parser               Execute                           Initialization                           Fields                           LearnCore                           String Parser                            Ascii

This is actually the list of triggers in there

Remember that the very first thing listed in the Trigger Editor is always the name of the map. This means that I can easily find the map's name via FileExporter : D.

The only issue is that this will require an initialization script to retrieve the file's name and store it into the JASS file or w/e : |.
 
Level 19
Joined
Oct 15, 2008
Messages
3,231
I wish we could try to contact the admins to place [LUA], [WeWarlock], [vJASS], [cJASS] and [Zinc] tags inside the Trigger section too, that way, the other users would find it much more convienient:)

PS: Sorry for the Off-Topic, was just wondering because this is the first Lua thread I've seen.
 
Status
Not open for further replies.
Top