• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

External Script Import Collection

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,242
The //! import line has been around for a while, but it amazes me that no one has bothered to release a .j file containing various common systems which can then be imported into any map with a single line.

Of course there are some drawbacks such as systems not being up to date.
Though the only considerable downside is that you cannot ensure that the .j's function are above yours resulting in "undefined function".
 
various common systems
The only such systems that are so general and useful that one must always include in their map (in my opinion)
would be those that aid in developing/debugging the map

Because Jass2 has no debugger (that I know of) one often uses "print style debugging" and systems that help here might be those that print stuff to the screen (BJDebugMsg, not really a system...), to a file or a multiboard... another form of visual debugging might be the use of the lighting natives for seeing locations/xyz, etc.

Because war3 doesn't have in-game developing capabilities (that I know of) a poor man's version might be: chat command handling system that makes it easy to add new commands with arguments for tinkering in-game, such a system might require some string processing/conversion functions (split, rawcode-to-integer, integer-to-rawcode), but that's only for tinkering with "cooked" functionality, you can't change the implementation of something (an object/property of an object in the editor, a jass function, etc) and hot reload (that would be awesome), you have to exit the game, make the change, recompile the map, load the map, go to the previous state of things and then see your change (which is kind of lame, but understandable for an oldish game).


System that are not general enough (in my opinion) would be:

unit indexing - it's true that most maps would use units in some way, but in my opinion there are better/easier ways

sound system - not all maps play sounds

hashtable wrapper library (Table) - not all maps use hashtables or if they do don't need they syntax sugar, or they just use structs

player handling library - some maps are single player


I guess the general rule would be:
some library/system that does/helps with type X - map does not use type X (in the sound system example: X = sound, in the hashtable: X = hashtable, etc)


Though the only considerable downside is that you cannot ensure that the .j's function are above yours resulting in "undefined function".

This is what libraries are for right?

Although their syntax is kind of bad because you have to write them on a single line or use ugly multiline comments...
JASS:
library Foo requires VeryLongLibName01, VeryLongLibName02, VeryLongLibName03, VeryLongLibName04, VeryLongLibName05, VeryLongLibName06, VeryLongLibName07
endlibrary

// not valid vJass :/
//
library Bar

// this seems better in my opinion
requires VeryLongLibName01
requires VeryLongLibName02
requires VeryLongLibName03
requires VeryLongLibName04
requires VeryLongLibName05
requires VeryLongLibName06
requires VeryLongLibName07

// beginblock-endblock pair of an alternative syntax
requires
  VeryLongLibName01
  VeryLongLibName02
  VeryLongLibName03
  VeryLongLibName04
  VeryLongLibName05
  VeryLongLibName06
  VeryLongLibName07
endrequires

endlibrary

Also the identifiers for libraries have a dumb restriction, i.e you can't have '_' nor '-' in the name, really
it should of been whatever a file system allows for a name of a file so that one can use the same:

my-lib.j:
JASS:
library my-lib
// cool stuff
endlibrary
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,242
the .j file needs to be in jass so you can't use libraries to ensure that one is above the other.

I see your point about unit indexers etc, but honestly I don't think you can make a any decent map without a unit indexer, a dds. Even if you don't use it personally, systems you want to use may require them.
And even if you happen to get TimerUtils (for example) in your map, and not using it once.. it's not the end of the world.

In the end it would just be an extended API apart of the default one.
 
but honestly I don't think you can make a any decent map without a unit indexer

Well, one of the best (in my opinion) maps (actually there are a few TcX based maps: TcX 1.03, TcX AoS, TcX "christmas" edition =)), and my favorite, is TcX. It doesn't use a unit indexing system (i.e using detector abilities (like: Defend, etc.)) and I think it's pretty decent.
 
Status
Not open for further replies.
Top