Struct and Methods( Quick Tutorial )

Chaos_Knight

New Member
Reaction score
39
Can someone tell me how to use Structs and/or Methods.
I heard that they are very useful.

//Chaos_Knight :cool:
 

Chaos_Knight

New Member
Reaction score
39
I dont understand that. [ljass]integer y
integer x[/ljass] It's overall very hard to understand. and all those [ljass].[/ljass]
dots.
 

tooltiperror

Super Moderator
Reaction score
231
JASS:

struct Food
   string name
endstruct


Make a struct, add the name attribute.

JASS:

function onInit takes nothing returns nothing
    local Food pizza=Food.create()
    set pizza.name="Giovanni's Specialty"
endfunction
 

tooltiperror

Super Moderator
Reaction score
231
Methods:
JASS:
//Warning: FirefoxJASS.
struct Food
   string name
   boolean isBaked=false
     method bake takes nothing returns nothing
        set this.isBaked=true
     endmethod
endstruct


JASS:
//Warning: FirefoxJASS.
function onInit takes nothing returns nothing
    local Food pizza=Food.create()
    set pizza.name="Giovanni's Specialty"
    call pizza.bake()
      if pizza.isBaked=true then
        call BJDebugMsg("Mama Mia, the pizza is baked and the method works!")
      else
        call BJDebugMsg("ToolTip made an error.")
      endif
endfunction
 

tooltiperror

Super Moderator
Reaction score
231
Literally, in disguise. When compiled to JASS2, methods are just functions.
 
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