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.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      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