• 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.

[JASS] How do you find the native pair of a BJ?

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
You have to look up each BJ in a editor like JASS SHOP PRO or JASS CRAFT and simply replace the fields to that the BJ function does.

Some are simple swaps, other are exactly the same while some are actually a piece of code that does something using many natives (example the one that returns the number of units in a group is made from natives and has no single native function which does the same).
 
Level 6
Joined
Jun 30, 2006
Messages
230
Dr. Super Good summed it up pretty well. Like he said, sometimes the BJ's simply call one other function and doing nothing else, which are the bad BJ's. Other BJ's have no native equivalent, but sometimes you can recreate the functions better than they do.

Here is page you can download JassCraft 1.1.13 from.
 
Level 6
Joined
Mar 2, 2006
Messages
306
if you're NOT a programmer (outside warcraft), use jass shop pro or jass craft.

if you are (a decent one, at least), don't use those. trust me. get blizzard.j (if you want, i can send it to you) and common.j from the game and keep it handy.

when you need a bj->native open it up (it's 416K, so don't use notepad for opening it) and search for your function. examine it to see what it does and what is the optimal replacement.

example 1: remember how you create one unit from gui? well look up CreateNUnitsAtLoc function. note that it calls CreateUnitAtLocSaveLast. examine that one as well and you'll see that you need neither of them. you will find that you can use the native:
set NewUnit = CreateUnitAtLoc( player, unitid, loc, facing )
or if you have the coordinates (and you took a peek at common.j), you can say:
set NewUnit = CreateUnit( player, unitid, x, y, facing )
by doing that, you avoided calls to CreateNUnitsAtLoc, CreateUnitAtLocSaveLast and GetLastCreatedUnit (3 bj functions).

example 2: you want to add 5 to hero's strength. so you call ModifyHeroStat which calls two needless bj functions GetHeroStatBJ and SetHeroStat because main function takes both attribute (str/int/agi) and action (add/sub/set) as function arguments.
and all you needed were two simple SetHeroStr and GetHeroStr native functions. quite easy to see, faster and simpler with a text viewer then with those two programs suggested above.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
edge[d1] stop attracting attention and making other peoples lives harder.

Jass shop pro and jass craft show you the function the BJ is in a box bellow so not only will it save time but it also shows the entire function and how it works by using the "j" files. Any manual way is slow and not any better, afterall thoes tools are made to make life easier and not limate the power of jass.
 
Level 6
Joined
Mar 2, 2006
Messages
306
edge[d1] stop attracting attention and making other peoples lives harder.
?!?

manual way is slow and not any better, afterall thoes tools are made to make life easier and not limate the power of jass.
that is a matter of personal preference and there's no point arguing about what's better. i will always use manual may. you don't have to.
reasons:
1: blizzard.j has changed along with game versions over time. when i upgrade wc, i always check if j files are different.
2: my favorite text viewer offers swift operation with keyboard shortcuts, advanced search possibilities and bookmarks...
 
Level 6
Joined
Jun 30, 2006
Messages
230
Jass Shop Pro has a little search thing. If you know what you are doing, you can use regular expressions as well.

That being said, Notepad++ has a better search, but anyone coding here would certainly use a relevant JASS editor, yes? Versus using Notepad which doesn't highlight the code in colors, which is useful, but it does show parenthesis. If you are a GOOD Jasser, I guess notepad++ would be better, but if you make mistakes.... Jass Shop Pro is better by far.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
If you are a GOOD Jasser, I guess notepad++ would be better
Erm, no matter how much of a "GOOD Jasser" you are, I doubt you 've memorized every native+function, its parameters, what it does, etc, etc.

but if you make mistakes.... Jass Shop Pro is better by far.
Everyone makes the occasional typo. That doesn't mean they're "bad coders" or anything.

Versus using Notepad which doesn't highlight the code in colors
Someone did a script for Notepad++ that adds highlighting compatible with vJass. It's somewhere on wc3campaigns (tools section, I think)

I personally don't really see any advantage to using Notepad/Notepad++, and alot of advantages to using JassCraft/JassShopPro. It's all a matter of preference, though, I suppose.
 
Status
Not open for further replies.
Top