• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Jass Newboy questions

Status
Not open for further replies.
Level 13
Joined
May 11, 2008
Messages
1,198
ok so i think i'm starting to get the hang of this stuff...let's see if i got it right...

global variables are for use with other variables...
and local variables are for use with other variables...

or is it global and local by function?

if so it would mean i can keep using the same named local variable right?
or is that a no?
i'm just trying to figure out if i can keep that name or if i have to keep entering in more and more information.

i'm more concerned about using too many variables than making too much work for myself. if i use too many variables i'll probably screw myself over.

i just don't know...does it make a difference? here is an example.

Events
Unit - A unit owned by Neutral Extra Dies


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to critters[1]
Then - Actions
Custom script: local location = rezp2
Custom script: set rezp2 = GetRectCenter(udg_regions[2])
Unit - Create 1 structures[0] for players[3] at points facing Default building facing degrees
Custom script: call RemoveLocation(rezp2)
Custom script: set rezp2 = null
Selection - Select (Last created unit) for (Owner of (Last created unit))
Game - Display to (All players) the text: texts[4]
Else - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to critters[2]
Then - Actions
Custom script: local location = rezp3
Custom script: set rezp3 = GetRectCenter(udg_regions[3])
Unit - Create 1 structures[0] for players[4] at points facing Default building facing degrees
Custom script: call RemoveLocation(rezp3)
Custom script: set rezp3 = null
Selection - Select (Last created unit) for (Owner of (Last created unit))
Game - Display to (All players) the text: texts[4]
Else - Actions

so i guess what i'm asking is...since these are each a function, are the local variables contained within each function? and is that why it would be okay if i named the point variables of all 9 functions in the trigger rezp? or do i have to do like calling each of them rezp1, rezp2, rezp3, etc... and would calling them each, in other words, making more variables be bad? i am removing and nullifying them right but is that not enough?

edit: whoops i just noticed these triggers won't work as of now because that creating structure action is still using the global variable...i guess i need to use custom text to make it target the local variable point, yes?
ok, this is good, right?

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to critters[1]
Then - Actions
Custom script: local location = rezp2
Custom script: set rezp2 = GetRectCenter(udg_regions[2])
Custom script: call CreateNUnitsAtLoc( 1, udg_structures[0], udg_players[3], rezp2, bj_UNIT_FACING )
Custom script: call RemoveLocation(rezp2)
Custom script: set rezp2 = null
Selection - Select (Last created unit) for (Owner of (Last created unit))
Game - Display to (All players) the text: texts[4]
Else - Actions

edit2: uh oh i have errors...expecting variable name? ugh these tutorials sure don't explain everything do they? hmm...expecting endif...i don't understand...expecting name? it's happening almost every line i'm making a mistake...should i just read more tutorials? haha...oh man. hard to use JASS programming for sure.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Functions are NOT Triggers.

  • Unit - Create 1 structures[0] for players[3] at points facing Default building facing degrees
This is a function. Here is it's declaration
function CreateNUnitsAtLoc takes integer count, integer unitId, player whichPlayer, location loc, real face returns group


Locals exist only in the functions they were declared in, so if you try to compile this code
JASS:
function bla2 takes nothing returns int
    return i + 2
endfunction

function bla takes nothing returns nothing
    local integer i = 5
    bla()
endfunction
it won't work, because "i" doesn't exist in bla2.

As to variables in general, they are just objects that hold values which you can refer to.

Local variables are variables that, as I said, exist only in their function. Since warcraft is linear (not multithreaded, search that in google if you are interested), this means that you cannot over write locals.
If you will use a global, for example it will look like this:
JASS:
// notice that globals are named udg_NAME in warcraft 
// udg stands for "user defined global"
function bla2 takes nothing returns int
    return udg_i + 2
endfunction

function bla takes nothing returns nothing
    local integer udg_i = 5
    bla() // will return 7
endfunction
This will run without any errors because it is a global, and thus any function can access it, BUT, you will always over write udg_i, which in a lot of cases you won't want to do.

Also, you might have heard (and will hear it a lot) that "BJs must be avoided".
So, what are this evil BJs?
BJs are simply functions located in a file named blizzard.j, and are used in the GUI.
Why were this functions created? Don't ask me, as about 95% of them are useless.
Why should they be avoided? Well, most (not all, some of them are useful) of them are just what is called in programming "wrapers". They wrap the real code with a "easier to read code", just that in this case, instead of easier to read, they are just idiotic.

Take this as an example of a useless BJ function
JASS:
function IsUnitAliveBJ takes unit whichUnit returns boolean
    return not IsUnitDeadBJ(whichUnit)
endfunction
  • ((Some_Unit) is dead) Equal to True/False
As you can see, it simply calls the IsUnitDeadBJ functions, why not to directly call it alone?
Now lets go further on, you can see also IsUnitDeadBJ is a BJ so lets check if also this is useless

JASS:
function IsUnitDeadBJ takes unit whichUnit returns boolean
    return GetUnitState(whichUnit, UNIT_STATE_LIFE) <= 0
endfunction

Nice... this calls yet ANOTHER function. Calling lots of functions is making our computer work harder... and for what?
We could just put this condition

JASS:
if GetUnitState(whichUnit, UNIT_STATE_LIFE) <= 0 then
// actions
endif

And look, we avoided two unnecessary function calls.
I would write more info and link to tutorials, but I must go now.
 
Level 13
Joined
May 11, 2008
Messages
1,198
update:
oh thankyou for replay...uhmm....yeah so i've read about 10 plus tutorials or so. i don't understand alot of it...but i understand alot more than when i made this new thread...

i have a few other questions now. you can ignore those others that i had.
apparently gui is really bad so i want to use only jass but alot of jass i don't understand just yet.

how do you use jasscraft? is there a tutorial for that somewhere? i don't understand using jasscraft at all.

what is the taking and returning all about?
like

function takes something returns something

i understand how to put information in there i'm just trying to figure out what that's for.
like for example you type in group unitgroupname or rect regionname, stuff like that...right? uhm but then what are those used for.

further, could anyone help me with a few of my triggers? in my tag map my runners die and get rescued alot, and i am pretty sure most of my memory leaks that haven't been fixed are in my runner dying and runner being rescued triggers.

so i converted from gui to custom text/jass and then i did some more editing but it looks like i can probably do some more? is what i can do more related to the taking and returning?

look how incredibly long this trigger is (and while we're on the subject, how do you do that scrolling box thing in the post? maybe i should edit the post and give it one?)...let me sum it up.

the first part is setting an integer global variable...it's the current points of the demon hunter making the kill...this trigger gives the points to the demon hunter from the runner kill, another gives them points for killing those buildings, well after that there is an attempt to kill certain types of units owned by the runner that died. everything works just fine...i guess...i'm not too incredibly sure if the points for the runner are kept track of properly, but that's not a big deal...maybe.

anyway as you can see this is a huge mass of text and if anyone wants to show me how to make it alot simpler and smaller and leak free i'm sure i would learn alot, and i would be very grateful.

one thing that was on my mind currently is if you notice down where it's trying to get rid of units...it has this funny command:
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func014Func008002 )
that b of course is the group name, at any rate...it says "Func008002", and the other commands are like that too, except for that part, now that was from converting from gui to jass, right? but when i went to add the udg_structures[17] i used the Func008002 from the udg_structures[4]. and i got no errors, and i tested it in map and the udg_structures[17] works fine, i'm just wondering if that means that the Func008002 can be used for all of those...

edit: i thought someting looked funny, i also noticed that the Func014 part was different too, i actually used Func015, and there was Func012 and those other numbers amongst all that too...i'm STARTING to WONDER if when i was testing it, something seemed a little fishy...did all of a sudden a bunch of the units disappear while i was waiting for one at a time? they had the wander ability and were flying around so it was hard to tell how many there were, but by the time i got down to killing 7 and 8 of the runners, i know it was working right, it seems that with the if boolean functions that possibly those flying units got cut only after i killed that one particular runner that corresponded with the Func015Func008002...is that right?

anyway, hopefully the above paragraph will show you i'm a thinker so i'll probably understand every change you make if you know of alot of good ones you can make, and give a brief explanation if possible.

i'm pretty sure there are going to be alot of changes needed, so if you can only make a few, i'll take whatever i can get, obviously i don't need you to do all the work for me, just pick out examples(from my trigger), and explain what you want me to do and i can do it myself.

function Trig_Runner_dies_Copy_Func001Func003C takes nothing returns boolean
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[0] ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[1] ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[2] ) ) then
return true
endif
return false
endfunction

function Trig_Runner_dies_Copy_Func001C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetKillingUnitBJ()) == udg_players[0] ) ) then
return false
endif
if ( not Trig_Runner_dies_Copy_Func001Func003C() ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func002Func003C takes nothing returns boolean
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[0] ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[1] ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[2] ) ) then
return true
endif
return false
endfunction

function Trig_Runner_dies_Copy_Func002C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetKillingUnitBJ()) == udg_players[1] ) ) then
return false
endif
if ( not Trig_Runner_dies_Copy_Func002Func003C() ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func003Func003C takes nothing returns boolean
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[0] ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[1] ) ) then
return true
endif
if ( ( GetUnitTypeId(GetTriggerUnit()) == udg_structures[2] ) ) then
return true
endif
return false
endfunction

function Trig_Runner_dies_Copy_Func003C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetKillingUnitBJ()) == udg_players[10] ) ) then
return false
endif
if ( not Trig_Runner_dies_Copy_Func003Func003C() ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func004C takes nothing returns boolean
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetKillingUnitBJ()) == udg_players[0] ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func005C takes nothing returns boolean
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetKillingUnitBJ()) == udg_players[1] ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func006C takes nothing returns boolean
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
if ( not ( GetOwningPlayer(GetKillingUnitBJ()) == udg_players[10] ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func007Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func007Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func007Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func007Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func007Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func007C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[2] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func008Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func008Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func008Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func008Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func008Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func008C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[3] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func009Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func009Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func009Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func009Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func009Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func009C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[4] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func010Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func010Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func010Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func010Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func010Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func010C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[5] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func011Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func011Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func011Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func011Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func011Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func011C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[6] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func012Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func012Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func012Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func012Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func012Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func012C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[7] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func013Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func013Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func013Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func013Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func013Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func013C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[8] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func014Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func014Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func014Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func014Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func014Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func014C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[9] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Func015Func005002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func015Func008002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func015Func011002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func015Func014002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func015Func017002 takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Runner_dies_Copy_Func015C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == udg_players[11] ) ) then
return false
endif
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return false
endif
if ( not ( IsUnitIllusionBJ(GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction

function Trig_Runner_dies_Copy_Actions takes nothing returns nothing
local location a
local group b
if ( Trig_Runner_dies_Copy_Func001C() ) then
set udg_integerpoints[0] = GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]))
else
endif
if ( Trig_Runner_dies_Copy_Func002C() ) then
set udg_integerpoints[1] = GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]))
else
endif
if ( Trig_Runner_dies_Copy_Func003C() ) then
set udg_integerpoints[2] = GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]))
else
endif
if ( Trig_Runner_dies_Copy_Func004C() ) then
set udg_integerpoints[0] = GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]))
else
endif
if ( Trig_Runner_dies_Copy_Func005C() ) then
set udg_integerpoints[1] = GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]))
else
endif
if ( Trig_Runner_dies_Copy_Func006C() ) then
set udg_integerpoints[2] = GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]))
else
endif
if ( Trig_Runner_dies_Copy_Func007C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[0], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func007Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func007Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func007Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func007Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func007Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 4, "ReplaceableTextures\\CommandButtons\\BTNAlbatross.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[21] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 4, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
if ( Trig_Runner_dies_Copy_Func008C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[1], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func008Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func008Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func008Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func008Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func008Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 5, "ReplaceableTextures\\CommandButtons\\BTNCritterChicken.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[22] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 5, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
if ( Trig_Runner_dies_Copy_Func009C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[2], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func009Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func009Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func009Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func009Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func009Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 6, "ReplaceableTextures\\CommandButtons\\BTNSpinyCrab.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[23] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 6, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
if ( Trig_Runner_dies_Copy_Func010C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[3], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func010Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func010Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func010Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func010Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func010Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 7, "ReplaceableTextures\\CommandButtons\\BTNWolf.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[24] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 7, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
if ( Trig_Runner_dies_Copy_Func011C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[4], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func011Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func011Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func011Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func011Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func011Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 8, "ReplaceableTextures\\CommandButtons\\BTNDuneWorm.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[25] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 8, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
if ( Trig_Runner_dies_Copy_Func012C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[5], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func012Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func012Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func012Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func012Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func012Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 9, "ReplaceableTextures\\CommandButtons\\BTNFelBoar.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[26] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 9, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
if ( Trig_Runner_dies_Copy_Func013C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[6], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func013Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func013Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func013Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func013Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func013Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 10, "ReplaceableTextures\\CommandButtons\\BTNHex.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[27] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 10, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
if ( Trig_Runner_dies_Copy_Func014C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[7], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func014Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func014Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func014Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func014Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func014Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 11, "ReplaceableTextures\\CommandButtons\\BTNCritterRabbit.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[28] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 11, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
if ( Trig_Runner_dies_Copy_Func015C() ) then
set a=GetRandomLocInRect(udg_regions[10])
call CreateNUnitsAtLoc( 1, udg_critters[8], udg_players[12], a, bj_UNIT_FACING )
call RemoveLocation(a)
set a = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[3])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func005002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[4])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[5])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func011002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[6])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func014002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[7])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func017002 )
call DestroyGroup(b)
set b = null
set b=GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), udg_structures[17])
call ForGroupBJ( b, function Trig_Runner_dies_Copy_Func015Func008002 )
call DestroyGroup(b)
set b = null
call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_LUMBER )
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12]), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetKillingUnitBJ(), udg_item_Copy[12])) + 1 ) )
call DisplayTextToForce( GetPlayersAll(), udg_texts[3] )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 12, "ReplaceableTextures\\CommandButtons\\BTNRacoon.blp" )
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_texts[29] )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 12, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
else
endif
endfunction

//===========================================================================
function InitTrig_Runner_dies_jass takes nothing returns nothing
set gg_trg_Runner_dies_jass = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Runner_dies_jass, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Runner_dies_jass, function Trig_Runner_dies_Copy_Actions )
endfunction
 
Level 13
Joined
May 11, 2008
Messages
1,198
ok, let me make sure i understand this right...
is it true, basically any time you convert any trigger from gui to jass you will get errors?
look at this, i converted a trigger that just says map initialization to jass and ran it through jass craft and got one error, i had to do local trigger a at the beginning of that function at the bottom, since it said set and started naming an undeclared variable, so i declared it and renamed the local variable a of course and replaced that other variable name and ran it through jasscraft and got no errors.

is this normal? does this mean that all gui triggers have errors? or does it mean that converting gui to jass results in errors that need to be fixed? i guess it doesn't matter either way...i was just curious.

edit: actually i guess it does matter, cuz if all gui triggers have errors that means i have to convert them all to jass and then fix them.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
JassCraft is just a text editor (same as Windows Notepad) but with some additions specialized for Jass.
The two important ones are of course the Functions List, which lists all the functions in common.j and blizzard.j so you don't need to search them, and the syntax checker which checks if your code is synthetically right (since WE's syntax checker = a bunch of horse dung).

You can also call the text highlighting (different colors for commands / functions / locals / etc) important, but it's less important then those two.

So, you just write whatever you want like you do in the WE, syntax check it, and copy it into the WE.

There is a better program (JassCraft is a bit outdated) called JNGP (Jass New Gen Pack), which is a hacked world editor which gives you all that JassCraft gives you plus vJass (don't bother with this yet), and some cool features that have nothing to do with Jass.

If you want it, go download it here.
I'm not sure if it's still not updated to work with the new warcraft patch (not so new now), so if it isn't, check this post to fix it.

Ok, onto functions.
Say you want a function that adds two numbers and gives you the final answer of the value.
So, the function takes for example 2 + 5, and returns 7.

Now, if you want that function to basically be able to take any numbers and return the addition value, you tell that function to take two values, lets say two integers (integers are full numbers, for example 0, -23, 495), and return an integer which will be the addition between them.
Let's type this in Jass (and by the way, when posting Jass codes wrap them with [jass][/code] tags)

JASS:
function addition takes integer one, integer two, returns integer
    return one + two
endfunction

As you can see, it takes two integers, and returns the addition between them.
The return value doesn't need to have a name (who cares what's its name :p).
The parameters (values) it takes must have names, any names you want mind you, so you would be able to refer to them in the function.

Now to call that function we just made, let's write a test function.

JASS:
// notice that a function can take and/or return nothing as well, it's all about what you need
function test takes nothing returns nothing
    local integer one = addition(2,20) // this will be 22
    local integer two = addition(50,5) // this will be 55
    BJDebugMsg(I2S(one)) // BJDebugMsg just out puts messages to all players.
                 // I2S is Integer to String, which converts your integer to a string
    BJDebugMsg(I2S(two)
endfunction

Now call that function somewhere in your code and see if it works :p

Hope I managed to explain some stuff here.
 
Level 13
Joined
May 11, 2008
Messages
1,198
oh thanks, was trying to figure out what I2S meant and how i should be able to remember it...
are integers the best way to use takes and returns?

i kindof already read about that in tutorials...unless i'm missing something i need to find out what taking and returning does with other types of variables... but thankyou for the information.
 
Status
Not open for further replies.
Top