• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] JASS help - Variable "transfer"

Status
Not open for further replies.
Level 10
Joined
Dec 13, 2008
Messages
222
I have a question that will maybe be simple to experienced mappers. It is about JASS functions. Can someone tell me how can I "transfer" local variables from one function to another, WITHOUT using vJass?

Example

JASS:
function bb takes ??? returns nothing
i want to transfer unit u, integer i and real r variables here
...
endfunction

function aa takes nothing returns nothing
local unit u
local real r
local integer i
local timer t = CreateTimer()

set u = MyUnit
set r = MyReal
set i = MyInt

call TimerStart(t, 0.04, true, function bb)

I hope someone can help me. :)
 
erm you need global variables, or you can use gamecache (Handle Variables coded by KaTTaNa)

JASS:
//with global variables
//WARNING: THIS IS NOT MULTI-INSTANCEABLE!

function bb takes nothing returns nothing
local unit u=udg_MyUnit
local integer i=udg_MyInt
local real r=udg_MyReal
...
...

set u=null
endfunction

function aa takes nothing returns nothing
local timer t = CreateTimer()

set udg_MyUnit= GetSpellAbilityUnit()//or whatever
set udg_MyReal= 1.0//or whatever
set udg_MyInt=1//or whatever
call TimerStart(t, 0.04, true, function bb)

set t=null
endfunction
 
Status
Not open for further replies.
Top