hellfish6 7 Posted September 10, 2004 Yo I'm working on the NAFP soldiers and I want to get three seperate inits running via EHs. I know how to call up one EH just fine, but with multiples I'm getting a bit lost. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class EventHandlers { Init = [_this select 0] exec "\nafinf\scripts\init.sqs"; [_this select 0,1] exec "\nafinf\scripts\rocamcrank.sqs"; [_this,"NAFFal","NAFfalmag"] exec "\NAFEvents\onPlayerInit.sqs"; hit = if (player == _this select 0) then {_this call NAFfuncHit}; killed = if (player == _this select 0) then {_this exec "\NAFEvents\onPlayerDeathBlack.sqs"}; fired = if (NAFWeaponFXinit) then {_this call NAFfuncFiredEH}; }; OFP comes up with the following error message when I try to run it: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">'nafinf\config.cpp/cgfVehicles/nafinfsoldierGB/EventHandlers.': "" encountered instead of '=' Any ideas? Share this post Link to post Share on other sites
korax 4 Posted September 10, 2004 Heres an example of a proper EH <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">init = "[1,0,_this] exec ""\weapon\foldier\script.sqs"";"; Share this post Link to post Share on other sites
hellfish6 7 Posted September 10, 2004 Still getting the problem. The config works fine when I take out the other two inits, leaving only the first, but not when all three are in there. My current init: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class EventHandlers { Init = "[_this select 0] exec ""\nafinf\scripts\init.sqs"";"; "[_this select 0,1] exec ""\nafinf\scripts\rocamcrank.sqs"";"; "[_this,"NAFFal","NAFfalmag"] exec ""\NAFEvents\onPlayerInit.sqs"";"; hit = if (player == _this select 0) then {_this call NAFfuncHit}; killed = if (player == _this select 0) then {_this exec "\NAFEvents\onPlayerDeathBlack.sqs"}; fired = if (NAFWeaponFXinit) then {_this call NAFfuncFiredEH}; }; Share this post Link to post Share on other sites
canukausiuka 1 Posted September 10, 2004 I think its because the whole init eventHandler needs to be in quotes. Basically, when you get to the single set of quote marks at the end of the first part of the init EH, OFP interprets that as you being done with that EH, esp. with the semicolon there. <I think> it ought to look more like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class EventHandlers { Â Â Init = "[_this select 0] exec ""\nafinf\scripts\init.sqs""; [_this select 0,1] exec ""\nafinf\scripts\rocamcrank.sqs""; [_this,""NAFFal"",""NAFfalmag""] exec ""\NAFEvents\onPlayerInit.sqs"";" Â Â hit = "if (player == _this select 0) then {_this call NAFfuncHit}"; Â Â Â Â killed = "if (player == _this select 0) then {_this exec ""\NAFEvents\onPlayerDeathBlack.sqs""}"; Â Â Â fired = "if (NAFWeaponFXinit) then {_this call NAFfuncFiredEH}"; }; or, using curled braces instead of quotes: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class EventHandlers { Â Â Â Init = "[_this select 0] exec {\nafinf\scripts\init.sqs}; [_this select 0,1] exec {\nafinf\scripts\rocamcrank.sqs}; [_this,{NAFFal},{NAFfalmag}] exec {\NAFEvents\onPlayerInit.sqs};" Â Â hit = "if (player == _this select 0) then {_this call NAFfuncHit}"; Â Â Â Â killed = "if (player == _this select 0) then {_this exec {\NAFEvents\onPlayerDeathBlack.sqs}}"; Â Â Â fired = "if (NAFWeaponFXinit) then {_this call NAFfuncFiredEH}"; }; Good luck with it Share this post Link to post Share on other sites
Scud 0 Posted September 10, 2004 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class EventHandlers { Â Â Init = "[_this select 0] exec ""\nafinf\scripts\init.sqs""; [_this select 0,1] exec ""\nafinf\scripts\rocamcrank.sqs""; [_this,""NAFFal"",""NAFfalmag""] exec ""\NAFEvents\onPlayerInit.sqs"";" by putting ; inside the last quote wouldn't that thro up an err? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">exec ""\NAFEvents\onPlayerInit.sqs"" "; that's how I thought it would be. Share this post Link to post Share on other sites
Footmunch 0 Posted September 10, 2004 Scud - No, the extra ; is just treated as a blank line. I often use it to separate the double-double quotes, and the end of the init string. Share this post Link to post Share on other sites
hardrock 1 Posted September 10, 2004 I corrected the last sample of MSMS a bit, that should be working: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class EventHandlers { init = "[_this select 0] exec {\nafinf\scripts\init.sqs}; [_this select 0,1] exec {\nafinf\scripts\rocamcrank.sqs}; [_this,{NAFFal},{NAFfalmag}] exec {\NAFEvents\onPlayerInit.sqs}"; hit = "if (player == _this select 0) then {_this call NAFfuncHit}"; killed = "if (player == _this select 0) then {_this exec {\NAFEvents\onPlayerDeathBlack.sqs}}"; fired = "if (NAFWeaponFXinit) then {_this call NAFfuncFiredEH}"; }; I also recommend the method with the curled brakes. The last command inside the string doesn't have to have a semicolon in the end, but each eventhandler has to! (there was an error with the init line. So init = "command; command; command;" is corrected to init = "command; command; command"; Share this post Link to post Share on other sites
canukausiuka 1 Posted September 10, 2004 Haha, thanks hardrock, you're right, I did overlook that. Knowing the way I code, if it was my mistake as I was working, I'd probably wind up spending an hour or so trying all sorts of crazy crap before finding it too Share this post Link to post Share on other sites