Tutorial JASS: Guide for GUI - JASS Conversion

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
For all you people like me that want to learn JASS, and know the GUI pretty well, I am working on a small little list/guide which will show you how to convert a little bit to JASS.

1. Abilities
2. Attack Types
3. Integers
4. Points/Locations
5. Units
6. Unit Groups

Code:
______________________________________________
\        GUI -- JASS Function Names          /
 \                                          /
  \                                        /
  /                                        \
  \                                        /
  /        Created By:   Darthfett         \
  \                                        /
  /                                        \
 /                                          \
/____________________________________________\


______________________________________________
\                Abilities                   /
/____________________________________________\

Ability being cast - GetSpellAbilityId()
______________________________________________
\              Attack Types                  /
/____________________________________________\

Spells - ATTACK_TYPE_NORMAL
       -
Normal - ATTACK_TYPE_MELEE
       -
Pierce - ATTACK_TYPE_PIERCE
       -
Siege  - ATTACK_TYPE_SIEGE
       -
Magic  - ATTACK_TYPE_MAGIC
       -
Chaos  - ATTACK_TYPE_CHAOS
       -
Hero   - ATTACK_TYPE_HERO

______________________________________________
\                 Integers                   /
/____________________________________________\

Integer functions are extremely easy in Jass.  Many do not even call a function, and use symbols.

Arithmetic (Addition)                     - *Integer* + *Integer*
                                          -
Arithmetic (Subtraction)                  - *Integer* - *Integer*
                                          -
Arithmetic (Multiplication)               - *Integer* * *Integer*
                                          -
Arithmetic (Division)                     - *Integer* / *Integer*
                                          -
Integer A                                 - bj_forLoopAIndex
                                          -
Integer B                                 - bj_forLoopBIndex
                                          -
String Length                             - StringLength(*String*)
                                          -
Conversion - Convert Real to Integer      - R2I(*Real*)
                                          -
Conversion - Convert String to Integer    - S2I(*String*)
                                          -
Destructible - Elevator Height            - GetElevatorHeight(*Destructible {Has to be an elevator}*)
                                          -
Environment - Terrain Cliff Level         - GetTerrainCliffLevelBJ(*Location*)
                                          -
Environment - Terrain Variance            - GetTerrainVarianceBJ(*Location*)
                                          -
Learned SKill Level                       - GetLearnedSkillLevel()
                                          -
Game - Number of Players                  - GetPlayers()
                                          -
Game - Number of Teams                    - GetTeams()
                                          -
Ally Color Filter Setting                 - GetAllyColorFilterState()
                                          -
Tournament Finish Rule                    - GetTournamentFinishNowRule()
                                          -
Tournament Melee Score for (Player)       - GetTournamentScore(*Player*)
                                          -
Game Cache - Load Integer Value           - GetStoredIntegerBJ(*String*,*String {Category}*, *Game Cache*)
                                          -
Hero Level                                - GetHeroLevel(*Unit {Hero}*)
                                          -
Hero Experience                           - GetHeroXP(*unit {Hero}*)
                                          -
Hero Attribute                            - GetHeroStatBJ(*Integer {The Stat type (Agi = 1, Str = 0,Int = 2)},*Unit {Hero}*,*Boolean {true if you want to exclude bonuses}*)
                                          -
                                          -
                                          - GetHeroStr(*Unit {whichHero}*,*Boolean {includeBonuses}*)
                                          -
                                          - GetHeroAgi(*Unit {whichHero}*,*Boolean {includeBonuses}*)
                                          -
                                          - GetHeroInt(*Unit {whichHero}*,*Boolean {includeBonuses}*)
                                          - 
                                          -
                                          -
Unspent Skill Points                      - GetHeroSkillPoints(*Unit{Hero}*)
                                          -
Item Level                                - GetItemLevel(*Item*)
                                          -
Item Charges Remaining                    - GetItemCharges(*Item*)
                                          -
Custom Value of Item                      - GetItemUserData(*Item*)
                                          -
Leaderboard - Leaderboard Position        - LeaderboardGetPlayerIndexBJ(*Player*,*Leaderboard*)
                                          -
Math - Random Integer                     - GetRandomInt(*Integer {Start #}*,*Integer {End #}*)
                                          -
Math - Min                                - IMinBJ(*Integer*,*Integer*)
                                          -
Math - Max                                - IMaxBJ(*Integer*,*Integer*)
                                          -
Math - Abs(olute Value)                   - IAbsBJ(*Integer*)
                                          -
Math - Sign                               - ISignBJ(*Integer*)
                                          -
Math - Modulo                             - ModuloInteger(*Integer*,*Integer*)
                                          -
Multiboard - Row Count                    - MultiboardGetRowCount(*Multiboard*)
                                          -
Multiboard - Column Count                 - MultiboardGetColumnCount(*Multiboard*)
                                          -
Neutral Building - Gold Remaining         - GetResourceAmount(*Unit{Gold Mines only}*)
                                          -
Player - Current Property                 - GetPlayerState(*Player*,*Player State*)
                                          -
Player - Tax Rate                         - GetPlayerTaxRateBJ(*Player State*,*Player{Player giving gold}*, *Player{Player receiving gold})
                                          -
Player - Score                            - GetPlayerScore(*Player*,*Player Score {The Type of Score}*)
                                          -
Player - Player Number                    - GetConvertedPlayerId(*Player*)
                                          -
Player - Count Structures                 - GetPlayerStructureCount(*Player*,*Boolean {Exclude Incomplete Structures?}*)
                                          -
Player - Count Non-Structures             - GetPlayerUnitCount(*Player*, *Boolean {Exclude Incomplete Units?}*)
                                          -
Player - Current Research Level           - GetPlayerTechCountSimple(*Research/Tech*,*Player*)
                                          -
Player - Max Research Level               - GetPlayerTechMaxAllowedSwap(*Research/Tech*,*Player*)
                                          -
Player - Player Team                      - GetPlayerTeam(*Player*) //Will return the Team NUMBER the player is in.
                                          -
Player - Count Players in Player Group    - CountPlayersInForceBJ(*Force*)
                                          -
Unit - Count Units in Unit Group          - CountUnitsInGroup
                                          -
Unit - Count Living Units Owned by Player - CountLivingPlayerUnitsOfTypeId(*Unit Type Id*,*Player*)
                                          -
Unit - Supply Used by Unit                - GetUnitFoodUsed(*Unit*)
                                          -
Unit - Supply Provided                    - GetUnitFoodMade(*Unit*)
                                          -
Unit - Supply Used by Unit-Type           - GetFoodUsed(*Unit Type Id*)
                                          -
Unit - Supply Provided by Unit-Type       - GetFoodMade(*Unit Type Id*)
                                          -
Unit - Point Value of Unit                - GetUnitPointValue(*Unit*)
                                          -
Unit - Point Value of Unit-Type           - GetUnitPointValueByType(*Unit Type Id*)
                                          -
Unit - Custom Value of Unit               - GetUnitUserData(*Unit*)
                                          -
Unit - Level of Unit                      - GetUnitLevel(*Unit*)
                                          -
Unit - Level of Ability for Unit          - GetUnitAbilityLevelSwapped(*Ability Id*,*Unit*)
                                          -
Unit - Count Items Carried                - UnitInventoryCount(*Unit*)
                                          -
Unit - Size of Inventory                  - UnitInventorySizeBJ(*Unit*)
                                          -
Unit - Count Buffs of Type                - UnitCountBuffsExBJ(*Buff Type {Magic and/or Physical}*,*Buff Type*,*Unit*,*Boolean {Include Expiration Timers}*,*Boolean {Include Auras}*)
                                          -
Trigger - Evaluation Count                - GetTriggerEvalCount(*Trigger*)
                                          -
Trigger - Execution Count                 - GetTriggerExecCount(*Trigger*)
                                          -
Trigger - Count Triggers in Trigger Queue - QueuedTriggerCountBJ()


______________________________________________
\             Points/Locations               /
/____________________________________________\

Center of (Region)                                                - GetRectCenter(*Region*)
                                                                  -
Random point in (Region)                                          - GetRandomLocInRect(*Region*)
                                                                  -
Center of (Region) offset by (X, Y)                               - OffsetLocation(*Region*, *Real {X}*, *Real {Y}*)
                                                                  -
Center of (Region) offset by (Distance) towards (Degrees) degrees - PolarProjectionBJ(*Region*, *Distance*, *Angle*)
                                                                  -
Target of (Camera)                 *1 player games only*          - CameraSetupGetDestPositionLoc(*Camera*)
                                                                  -
Target of current camera view      *1 player games only*          - GetCameraTargetPositionLoc()
                                                                  -
Source of current camera view      *1 player games only*          - GetCameraEyePositionLoc()
                                                                  -
Point(*X*, *Y*)                    *Coordinates*                  - Location(*Real {X}*, *Real {Y}*)
                                                                  -
Position of (Destructible)                                        - GetDestructableLoc(*Destructible*)
                                                                  -
Target point of issued order       *Event Response*               - GetOrderPointLoc()
                                                                  -
Target point of ability being cast *Event Response*               - GetSpellTargetLoc()
                                                                  -
Position of (Item)                                                - GetItemLoc(*Item*)
                                                                  -
Destination of (Waygate)                                          - WaygateGetDestinationLocBJ(*Unit*)
                                                                  -
(Player) start location                                           - GetPlayerStartLocationLoc(*Player*)
                                                                  -
Position of (Unit)                                                - GetUnitLoc(*Unit*)
                                                                  -
Rally point of (Unit) as a point                                  - GetUnitRallyPoint(*Unit*)

______________________________________________
\                  Units                     /
/____________________________________________\

GUI Usage                           JASS Usage

Last Created Unit                 - bj_lastCreatedUnit
                                  -
Last Restored Unit                - bj_lastLoadedUnit
                                  -
Last Replaced Unit                - bj_lastReplacedUnit
                                  -
Last Haunted Gold Mine            - bj_lastHauntedGoldMine
                                  -
Picked Unit                       - GetEnumUnit()
                                  -
Matching Unit                     - GetFilterUnit()
                                  -
Random Unit from Unit Group       - GroupPickRandomUnit(*UnitGroup*)
                                  -
Attacked Unit                     - GetTriggerUnit()
                                  -
Attacking Unit                    - GetAttacker()
                                  -
Buying Unit                       - GetBuyingUnit()
                                  -
Cancelled Structure               - GetCancelledStructure()
                                  -
Casting Unit                      - GetSpellAbilityUnit()
                                  -
Constructing Structure            - GetConstructingStructure()
                                  -
Constructed Structure             - GetConstructedStructure()
                                  -
Damage Source                     - GetEventDamageSource()
                                  -
Decaying Unit                     - GetDecayingUnit()
                                  -
Dying Unit                        - GetTriggerUnit()
                                  -
Entering Unit                     - GetEnteringUnit()
                                  -
Hero Manipulating Item            - GetManipulatingUnit()
                                  -
Killing Unit                      - GetKillingUnit()
                                  -
Learning Hero                     - GetLearningUnit()
                                  -
Leaving Unit                      - GetLeavingUnit()
                                  -
Leveling Hero                     - GetLevelingUnit()
                                  -
Loading Unit                      - GetLoadedUnit()
                                  -
Ordered Unit                      - GetOrderedUnit()
                                  -
Ownership-changed unit            - GetChangingUnit()
                                  -
Researching Unit                  - GetResearchingUnit()
                                  -
Revivable Hero                    - GetRevivableUnit()
                                  -
Reviving Hero                     - GetRevivingUnit()
                                  -
Selling Unit                      - GetSellingUnit()
                                  -
Sold Unit                         - GetSoldUnit()
                                  -
Summoned Unit                     - GetSummonedUnit()
                                  -
Summoning Unit                    - GetSummoningUnit()
                                  -
Target unit of issued order       - GetOrderTargetUnit()
                                  -
Target unit of ability being cast - GetSpellTargetUnit()
                                  -
Targeted unit                     - GetEventTargetUnit()
                                  -
Trained unit                      - GetTrainedUnit()
                                  -
Transporting unit                 - GetTransportUnit()
                                  -
Triggering unit                   - GetTriggerUnit()
                                  -
Rally-Point of (Unit) as a Unit   - GetUnitRallyUnit(*Unit*)

______________________________________________
\                Unit Groups                 /
/____________________________________________\

Last Created Unit Group                  - GetLastCreatedGroup()
                                         -
Random N Units from Unit Group           - GetRandomSubGroup(*N*, *Unit Group*)          
                                         -
Units in Region                          - GetUnitsInRectAll(*Region*)
                                         -
Units in Region owned by Player          - GetUnitsInRectOfPlayer(*Region*, *Player*)
                                         -
Units in Region matching condition       - GetUnitsInRectMatching(*Region*, *Condition*)
                                         -
Units in Range                           - GetUnitsInRangeOfLocAll(*Real {Range Amount}*, *Region*)
                                         -
Units in Range matching condition        - GetUnitsInRangeOfLocMatching(*Real {Range Amount}*, *Region*, *Condition*)
                                         -
Units owned by Player                    - GetUnitsOfPlayerAll(*Player*)
                                         -
Units owned by Player of type            - GetUnitsOfPlayerAndTypeId(*Player*, *UnitTypeID*)
                                         -
Units owned by Player matching condition - GetUnitsOfPlayerMatching(*Player*, *Condition*)
                                         -
Units of Type                            - GetUnitsOfTypeIdAll(*UnitTypeID*)
                                         -
Units Selected by Player                 - GetUnitsSelectedAll(*Player*)

This was originally already on here, but I guess it was deleted during the crash. I am going to be working on this again, since I thought it was pretty useful to me, and it might be for you too. :)
 

Attachments

  • GUI--JASS.txt
    20.1 KB · Views: 1,189

Sim

Forum Administrator
Staff member
Reaction score
534
> Random Unit from Unit Group - GroupPickRandomUnit(*UnitGroup*

Missing a parenthese at the end ! :D lol

Nice tutorial !
 
R

Raiyn

Guest
Yeah, that's my only advice. A new interface for this as well as some examples of basic triggers converted to JASS form would greatly help this tutorial. GJ for what you've done so far though.
 

Chocobo

White-Flower
Reaction score
409
Great Tutorial. That is a great guide for any JASS newbies.

BIG NOTE : The Player you want to refer in a Convert Player Number, example Player 1, will result Player(0). You always must remove 1 from the integer number of player. (2 = 1, 3 = 2....)

Code:
Units of Type                            - GetUnitsOfTypeIdAll(*Unit*)

It is
Code:
Units of Type                            - GetUnitsOfTypeIdAll(*Unit[COLOR=Red]TypeID[/COLOR]*)

Code:
Units in Range matching condition        - GetUnitsInRangeOfLocMatching(*Range Amount*, *Region*, *Condition*)

Code:
Units in Range matching condition        - GetUnitsInRangeOfLocMatching(*[COLOR=Red]Real[/COLOR] Range Amount*, *Region*, *Condition*)

Code:
Units in Range                           - GetUnitsInRangeOfLocAll(*Range Amount*, *Region*)

Code:
Units in Range                           - GetUnitsInRangeOfLocAll(*[COLOR=Red]Real[/COLOR]Range Amount*, *Region*)

Code:
Units owned by Player of type            - GetUnitsOfPlayerAndTypeId(*Player*, *Unit*)

Code:
Units owned by Player of type            - GetUnitsOfPlayerAndTypeId(*Player*, *Unit[COLOR=Red]TypeID[/COLOR]*)

Code:
Point(*X*, *Y*)                    *Coordinates*                  - Location(*X*, *Y*)

Code:
Point(*X*, *Y*)                    *Coordinates*                  - Location(*[COLOR=Red]Real[/COLOR] X*, *[COLOR=Red]Real[/COLOR] Y*)
 

Jazradel

Helping people do more by doing less.
Reaction score
102
Change things like:
Code:
Last Restored Unit                - LastRestoredUnitBJ
to
Code:
Last Restored Unit                - bj_lastLoadedUnit
and
Code:
Attacked Unit                     - AttackedUnitBJ
to
Code:
Attacked Unit                     - GetTriggerUnit()
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
609
When its updated ill add it to the tutorial review thread :)
 

Sim

Forum Administrator
Staff member
Reaction score
534
I want this tutorial in the section so I can always take a look at it :D

Useful information there heh. I like it !
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I was thinking more of variable types, and there uses, like integer, real, players, player groups, etc. Any specific ones you want? :)

I can't work on it right now though. I'm in my drafting class at school, but maybe when I get home?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top