vJASS Questions and such

Windwalk

New Member
Reaction score
8
1.where can i find a real good vJass tutorial?

2.What are structs?

3.What are methods and static methods?

4. what is a line like this?
JASS:
set g.u = GetTriggerUnit()
i thought u just do set g = GetTriggerUnit() how come you use variables inside structs... inside other functions

5. i know im noob bear with me s:....

6. "Function musn't have any arguements when being called" how do i get pass this if i need to use other variables from 1 function to another.

thanks i know im very noob but itd be better if someone could easily clear up all these questions for me =/
 

Windwalk

New Member
Reaction score
8

Flare

Stops copies me!
Reaction score
662
but variables inside structs can be used anywhere?
Anywhere that the struct is available (i.e. it's above the function that wants to use it, and isn't private with respect to the function that wants to use it) and where a struct instance (in the case of non-static members) has been declared e.g.
JASS:
function test takes nothing returns nothing
  local wee data = wee.create () //invalid, since the struct wee is below test, and wee is private with respect to this function
  set data.u = GetTriggerUnit () //again, invalid, same reason as above
endfunction


scope foo

private struct wee
unit u
endstruct

function test2 takes nothing returns nothing
  local wee data = wee.create () //valid, since wee is above this function
//and wee isn't private with respect to this function
  set data.u = GetTriggerUnit ()
endfunction

endscope
 

Romek

Super Moderator
Reaction score
963
You could use a keyword to make Flares code work, though function 'test' would have to be within the scope, as the struct is private.

JASS:
scope foo

private keyword wee

function test takes nothing returns nothing
  local wee data = wee.create () // valid. It is below the keyword
  set data.u = GetTriggerUnit () // See above
endfunction

private struct wee
unit u
endstruct

function test2 takes nothing returns nothing
  local wee data = wee.create () //valid, since wee is above this function
//and wee isn't private with respect to this function
  set data.u = GetTriggerUnit ()
endfunction

endscope
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top