Call a function from an if entity
3 replies



25.07.16 11:53:31 am
Hi guys, today I have a problem but first let me claim this:
I know 0% about this entity and I never used it, also I searched for a solution but found none (maybe searched for the wrong thing...).
How can I call a function from an if entity?
at, mapname.lua:
How to call fn() from the if entity? I don't want the function to be in the if statement I just want to call it.
I know 0% about this entity and I never used it, also I searched for a solution but found none (maybe searched for the wrong thing...).
How can I call a function from an if entity?
at, mapname.lua:
Code:
1
2
3
2
3
function fn()
msg("test")
end
msg("test")
end
How to call fn() from the if entity? I don't want the function to be in the if statement I just want to call it.
It's hard being the best girl in the whole entire world
What? Do you mean
trigger_if? Simply write
trigger_if when it's triggered. Don't worry with the

fn()
on the text box field. The function will called by 
if
statement. You could also use
dofile
to call the script (NOTE: it will trigger every function if you have multiple routines). The syntax has to be in this way:Code:
1
dofile('LuaPath')

What? Do you mean
trigger_if? Simply write
trigger_if when it's triggered. Don't worry with the

fn()
on the text box field. The function will called by 
if
statement.Thanks it worked and that's what I figured out that to use the trigger I need to return true on the function
It's hard being the best girl in the whole entire world



