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,192

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
  • The Helper The Helper:
    whatever at least you are free
  • 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!
  • 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

      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