Hi all
This is what I have ATM
function onDie(self)
local x , y = getForward( ( self.facing + 2 ) % 4 )
x = x + self.x
y = y + self.y
if killcounter:getValue() == 1 then
if not isWall( self.level , x , y ) then
spawn("spider",party.level,x,y,self.facing)
end
elseif killcounter:getValue() == 2 then
sd1:open()
---- Here I want to call (function addMoney) from the (rewardslvl1) Script in the Editor (see Below) --
end
end
1 - Script Entity Name: rewardslvl1
2 - The Script function I want to call: (its from the Shop Frame work, Magnus wrote)
function addMoney()-- adds money to the party
hudPrint("Guard: Good show! Here is an added bonus for cleaning the mess up! 20 Money added.")
gui.globalVars["totalMoney"] = gui.globalVars["totalMoney"] + 20
end
Thxs for any help..
How do i call a function in a function??
- Eleven Warrior
- Posts: 752
- Joined: Thu Apr 18, 2013 2:32 pm
- Location: Australia
Re: How do i call a function in a function??
rewardslvl1.addMoney() does not work? (it's pretty much the same syntax as "gui.setVar()", or "gui.globalVars[]", i.e., nameOfScript.nameOfFunction)
alois
alois
- DesperateGames
- Posts: 90
- Joined: Sun Oct 06, 2013 1:54 pm
Re: How do i call a function in a function??
I agree with alois rewardslvl1.addMoney() should work. Are you sure the function is not called? Or do you get an error message?
- Eleven Warrior
- Posts: 752
- Joined: Thu Apr 18, 2013 2:32 pm
- Location: Australia
Re: How do i call a function in a function??
Thxs guys ill give it a go.
This is what i was looking for rewardslvl1.addMoney() i just didnt know (remember how to call a function from another Script.. It was in front of me the whole time.. I thought it would be as you said Alois..
Thxs again guys
This is what i was looking for rewardslvl1.addMoney() i just didnt know (remember how to call a function from another Script.. It was in front of me the whole time.. I thought it would be as you said Alois..
Thxs again guys