12p Posted January 5, 2011 Share Posted January 5, 2011 res = getThisResource() addEvent ("onPlayerCallMission",true) function callMission (theMission) call (res,theMission,source) end addEventHandler ("onPlayerCallMission",getRootElement(),callMission) Simple script. I think what I'm doing it's okay, but when it triggers the event "onPlayerCallMission" it tells me "Bad Argument @ addEventHandler". That problem is in those lines. Am I doing any wrong thing? Link to comment
Kenix Posted January 6, 2011 Share Posted January 6, 2011 res = getThisResource() addEvent ("onPlayerCallMission",true) function callMission (theMission) call (res,theMission,source) end addEventHandler ("onPlayerCallMission",getRootElement(),callMission) Simple script. I think what I'm doing it's okay, but when it triggers the event "onPlayerCallMission" it tells me "Bad Argument @ addEventHandler". That problem is in those lines. Am I doing any wrong thing? try this , I could be wrong. res = getThisResource() addEvent ("onPlayerCallMission",true) function callMission (theMission) call (res,theMission,source) end addEventHandler ("onPlayerCallMission",getResourceRootElement(getThisResource()),callMission) Link to comment
Aibo Posted January 6, 2011 Share Posted January 6, 2011 what's the point in call() within the same resource? Link to comment
12p Posted January 6, 2011 Author Share Posted January 6, 2011 (edited) you would understand me if you know the reason... And thanks, volk, I will check and edit. EDIT: You were wrong, volk. It didn't work. Whatever, I just got the problem and solved it. Thanks anyway =) Edited January 6, 2011 by Guest Link to comment
SDK Posted January 6, 2011 Share Posted January 6, 2011 Do you by any chance mean going from a string (theMission) to a function? If so, you could use _G Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now