Functions

Kling[o]

New Member
Reaction score
7
I'm starting learning Jass and I wanted to know if there's a website or anything that show all Jass function?
 

Ashlebede

New Member
Reaction score
43
jass.sourceforge.net.

You can see all natives, functions, constants, variable types... everything!

See the API Browser. At the top-right you have a menu with three elements : Types | Functions | Variables. That's it.

You'll also have to check every file (common.j, common.ai and blizzard.j) if you're looking for a particular function.

common.j contains natives and default functions (often more complex but more efficient).

common.ai contains everything you need for Artificial Intelligence.

Blizzard.j contains only functions that make using the natives more simple. I rarely use them, since they are less performant and sometimes leak.
 

Ashlebede

New Member
Reaction score
43
No problem. You can also use Jass Shop Pro, NewGen WE or JassCraft, which all do the same job. They also highlight and check the syntax of your script. :)

NewGen WE also allows the use of vJASS, which is most useful. o_O
 

Ashlebede

New Member
Reaction score
43
How is Jass Shop Pro outdated? I know it's old, but it still works... except maybe for Hashtables. >_>
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, what he probably meant is that it doesn't have all the latest natives, like [ljass]GetHandleId()[/ljass] or [ljass]GetSpellTargetX/Y()[/ljass] or the hashtable stuff...

And it (Nor JassCraft) will not compile vJass, as only JassHelper does that...
 

tooltiperror

Super Moderator
Reaction score
231
that's kindof interesting but i'm uncertain why you posted it.

Type any function into the wiki's search bar (for example BJDebugMsg) and it will bring you to the page with it's analysis on it. Or, click on a function in blizzard.j (or I guess common.j for natives) in JASS or LJASS tags, and it will bring you there to. Like try clicking on some of these JASS-related topics.

[LJASS]ForGroup[/LJASS]
[LJASS]local integer[/LJASS]

Laiev which mpq file are you talking about?

Laiev was talking about common.ai, which the computer uses for generating Artificial Intelligence, as well as for it's own personal use in Single Player AI. Changing something in common.ai would change it in your WC3, things like this make personal WC4 projects possible.

I've posted my own common.ai's contents (I'm almost 100% sure it is the same on my Mac as on your PC) for you to view on pastebin, or you can extract your own common.ai with an MPQ Extractor (2).

If you view the other .ai files in the MPQ (for example u05_blue.ai, which deals with the Player 2 (blue) undead in mission five of the RoC Undead Campaign,) it will show you the AI for that mission.
 

SanKakU

Member
Reaction score
21
so...if i want to use any of those common.ai functions, i have to type them in my map first as i see them in common.ai?

like if i want to count the units of a unit type i type this:
[ljass]native GetUnitCount takes integer unitid returns integer[/ljass]
then i can type this:
[ljass]call GetUnitCount('hfoo')[/ljass]
which will get the number of all the footmen on the map? or what?? is it like the number of footmen the .ai player has in his possession? these functions' uses are so cryptic to me.

well, anyway...these mission scripts...that's cool...how do you put something like this in your own map?
 

Laiev

Hey Listen!!
Reaction score
188
>>so...if i want to use any of those common.ai functions, i have to type them in my map first as i see them in common.ai?

Yes
 

tooltiperror

Super Moderator
Reaction score
231
There is no way to find what these functions do, other than by testing them yourself. No one has ever taken the time to comment on the entire common.ai.

You won't even be needing anything in Common.AI if you don't plan on making Artificial Intelligence.

Let's say you want to use [LJASS]DebugS[/LJASS].

JASS:
native DebugS               takes string str                            returns nothing


You have to do [LJASS]call DebugS("some string")[/LJASS]. You can read the other .AI files to see how the game uses the functions in common.ai.

This is the script the AI uses for the second mission in RoC where you have the small base, you learn to build, and you attack that Orc Base.

JASS:
//============================================================================
//  Human 02 -- red player -- AI Script
//============================================================================
globals
    player user = Player(1)
endglobals

//============================================================================
//  main
//============================================================================
function main takes nothing returns nothing

    call CampaignAI(PIG_FARM,null)
	call SetReplacements(0,1,3)

	call CampaignDefenderEx( 1,1,1, HEAD_HUNTER	)
	call CampaignDefenderEx( 1,1,2, GRUNT		)
	call CampaignDefenderEx( 0,0,1, RAIDER		)


    //*** WAVE 1 ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 2,2,2, GRUNT       )
    call CampaignAttackerEx( 1,1,2, HEAD_HUNTER )
    call SuicideOnPlayer(M2,user)

    //*** WAVE 2 ***
    call InitAssaultGroup()
	call CampaignAttackerEx( 2,2,2, GRUNT       )
    call CampaignAttackerEx( 2,2,3, HEAD_HUNTER )
    call SuicideOnPlayer(M2,user)

	//*** WAVE 3 ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 4,4,4, GRUNT		)	
	call CampaignAttackerEx( 0,0,2, RAIDER		)
    call CampaignAttackerEx( 1,1,1, HEAD_HUNTER )
    call SuicideOnPlayer(M3,user)

    //*** WAVE 4 ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 3,3,3, GRUNT       )
    call CampaignAttackerEx( 1,1,3, HEAD_HUNTER )
    call SuicideOnPlayer(M2,user)

	loop
        //*** WAVE 5 ***
        call InitAssaultGroup()
		call CampaignAttackerEx( 1,1,3, GRUNT       )
		call CampaignAttackerEx( 0,0,2, RAIDER		)
        call CampaignAttackerEx( 4,4,4, HEAD_HUNTER )
        call SuicideOnPlayer(M3,user)

        //*** WAVE 6 ***
        call InitAssaultGroup()
		call CampaignAttackerEx( 4,4,5, GRUNT       )
        call CampaignAttackerEx( 1,1,2, HEAD_HUNTER )
        call SuicideOnPlayer(M3,user)

        //*** WAVE 7 ***
        call InitAssaultGroup()
		call CampaignAttackerEx( 2,2,3, GRUNT       )
		call CampaignAttackerEx( 0,0,2, RAIDER		)
        call CampaignAttackerEx( 3,3,4, HEAD_HUNTER )
        call SuicideOnPlayer(M4,user)
    endloop
endfunction


(Notice the first thing done is that the game engine does [LJASS]call main()[/LJASS].)
 

SanKakU

Member
Reaction score
21
i think i've been trying to figure out how to make ai since forever.
i don't get how you use would use these scripts.
as i see it, there's one global variable and then it makes use of many variables and functions from common.ai. and it does all of that in a single function called main.
 

tooltiperror

Super Moderator
Reaction score
231
The global variable is just changing [LJASS]Player(0)[/LJASS] to user so you don't need to keep calling [LJASS]Player[/LJASS].

If you wanted to make your own scripts like this, you could put them in a textfile named [LJASS]"MyAI.txt"[/LJASS] and put them in your JassHelper folder, then put [LJASS]//! import "MyAI.txt"[/LJASS] in your map header.

Or you could just code right in your editor.
 

SanKakU

Member
Reaction score
21
The global variable is just changing [LJASS]Player(0)[/LJASS] to user so you don't need to keep calling [LJASS]Player[/LJASS].

If you wanted to make your own scripts like this, you could put them in a textfile named [LJASS]"MyAI.txt"[/LJASS] and put them in your JassHelper folder, then put [LJASS]//! import "MyAI.txt"[/LJASS] in your map header.

Or you could just code right in your editor.

don't think you understand. i wasn't confused about the global variable. i'm confused about the function called main.
 

tooltiperror

Super Moderator
Reaction score
231
What don't you understand about it? It's just a normal function called on Map Init. Of course it looks like gibberish with the weird Blizzard JASS everywhere, but blame that on blizzard for not giving documentation on the AI.

The only way to decipher it is to test all those functions yourself in game.
 

SanKakU

Member
Reaction score
21
What don't you understand about it? It's just a normal function called on Map Init. Of course it looks like gibberish with the weird Blizzard JASS everywhere, but blame that on blizzard for not giving documentation on the AI.

The only way to decipher it is to test all those functions yourself in game.

well, if all the scripts have the same function main then when you call them you can't just say
call main()
because they all have the same name.
the scripts are for each player yet they have same main function name.

meh. i guess i should stop replying because you told me all you know already i suppose...you keep acting like you don't know what i'masking but really you're trying to avoid saying you don't know the answer.

well, thanks for letting me know what you did know, anyway.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top