- Joined
- Dec 29, 2006
- Messages
- 359
So, i just started learning JASS, so im still not an expert at recognizing my mistakes like syntax errors and such. This script that im using is for a tower defense, and it compares the clicked dialog button with the StageOne dialog button, and if the clicked button was the StageOne button, it pans the camera to the center of the stage, limits the camera bounds to that stage, then creates the builder for the player. Or rather, thats what it should do. I cant seem to put my finger on the error(s) that is/are making this code not work.
So i ask: could someone point out my errors and tell me what i SHOULD have done?
So i ask: could someone point out my errors and tell me what i SHOULD have done?
JASS:
function WhichButton takes nothing returns integer
if(GetClickedButton() == udg_StageOne) then
return 1
endif
return 1
endfunction
function GameStart takes nothing returns nothing
if WhichButton == 1 then
set udg_Stage = gg_rct_Stage_1
set udg_loc = GetRectCenter(udg_Stage)
local rect r = udg_Stage
local location x = GetLocationX(udg_loc)
local location y = GetLocationY(udg_loc)
call PanCameraTo(x, y)
call SetCameraBoundsToRect(r)
call CreateUnitAtLoc(Player(1), u000:uaco, udg_loc, 270.0)
call DisplayTimedTextToPlayer(Player(1), x, y, 5.00, "Welcome to Xzife Tower Defense! This is a solo tower defense coded entirely in JASS script. There is currently 1 stage, and the game is in the very early Alpha stage of development.")
call KillUnit(Peasant 0000)
r = null
x = null
y = null
endfunction
//=============================================================
function Init_Trig_Start_Game takes nothing returns nothing
local trigger gamestart = CreateTrigger()
call TriggerRegisterDialogButtonEvent(gamestart, udg_StageOne)
call TriggerAddAction(gamestart, function WhichButton)
call TriggerAddAction(gamestart, function GameStart)
set gamestart = null
endfunction