Page 1 of 4 1234 LastLast
Results 1 to 10 of 38

  Click here to go to the first Developer post in this thread.  

Thread: Multiple scripts run from one event handler

  1. #1
    Howdy all. Tanelorn here with another brain twister for ya.

    I am using tons of encapsulated scripts in my mod, since there are so many special behaviors for all my units.

    Well wouldn't you know it, the time has come for me to need more than one script to be run at unit initialization.

    Rather than have TONS of scripts in my scripts folder that are solely designed to be run for a particular unit, I am trying to keep all the hassle in the config file and shovel it out from there. It's a great idea, in fact, it looks darn near perfect.

    My problem: I have no idea how to do it! I'm running into syntax errors left and right when I try to cram two script calls in one event handler.

    Any ideas? I've tried tons of combinations. I'll bet there's one that will work if we put our heads together.

    Heres a sample of a non-working config snippet:

    // this event handler allows the vehicle to continuously regenerate it's ammunition
    class eventhandlers
    *** *** {
    *** *** *** *** ***init =
    *** *** *** *** ***{
    *** *** *** *** *** *** *** [_this select 0, "TA_VTOL_EMG"] exec "\ta_units\scripts\reload_freegun.sqs" ;
    *** *** *** *** *** *** *** [_this select 0, "TA_EMG_Gun"] exec "\ta_units\scripts\reload_freegun.sqs" ;
    *** *** *** *** ***};
    *** *** };

    http://ta.opflash.org/

  2.   Click here to go to the next Developer post in this thread.   #2
    BI Developer Suma's Avatar
    Join Date
    Jun 27 2001
    Location
    Czech Republic
    Posts
    3,708
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Tanelorn @ Dec. 10 2002,03:00)</td></tr><tr><td id="QUOTE">My problem: I have no idea how to do it&#33; I&#39;m running into syntax errors left and right when I try to cram two script calls in one event handler.

    Heres a sample of a non-working config snippet:

    class eventhandlers
    *** *** {
    *** *** *** *** ***init =
    *** *** *** *** ***{
    *** *** *** *** *** *** *** [_this select 0, "TA_VTOL_EMG"] exec "&#92;ta_units&#92;scripts&#92;reload_freegun.sqs" ;
    *** *** *** *** *** *** *** [_this select 0, "TA_EMG_Gun"] exec "&#92;ta_units&#92;scripts&#92;reload_freegun.sqs" ;
    *** *** *** *** ***};
    *** *** };[/QUOTE]<span id='postcolor'>
    Elementary, dear Watson. Use one very long line instead:

    class eventhandlers
    *** *** {
    *** *** *** *** ***init = "[_this select 0, ""TA_VTOL_EMG""] exec ""&#92;ta_units&#92;scripts&#92;reload_freegun.sqs "";[_this select 0, ""TA_EMG_Gun""] exec ""&#92;ta_units&#92;scripts&#92;reload_freegun.sqs """;
    *** *** };




    Ondrej Spanel, BIS Lead Programmer

  3. #3
    0--></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Suma @ Dec. 10 2002,180)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Tanelorn @ Dec. 10 2002,03&#60;&#33;--emo&)</td></tr><tr><td id="QUOTE">My problem: I have no idea how to do it&#33; I&#39;m running into syntax errors left and right when I try to cram two script calls in one event handler.

    Heres a sample of a non-working config snippet:

    class eventhandlers
    *** *** {
    *** *** *** *** ***init =
    *** *** *** *** ***{
    *** *** *** *** *** *** *** [_this select 0, "TA_VTOL_EMG"] exec "&#92;ta_units&#92;scripts&#92;reload_freegun.sqs" ;
    *** *** *** *** *** *** *** [_this select 0, "TA_EMG_Gun"] exec "&#92;ta_units&#92;scripts&#92;reload_freegun.sqs" ;
    *** *** *** *** ***};
    *** *** };[/QUOTE]<span id='postcolor'>
    Elementary, dear Watson. Use one very long line instead:

    class eventhandlers
    *** *** {
    *** *** *** *** ***init = "[_this select 0, ""TA_VTOL_EMG""] exec ""&#92;ta_units&#92;scripts&#92;reload_freegun.sqs "";[_this select 0, ""TA_EMG_Gun""] exec ""&#92;ta_units&#92;scripts&#92;reload_freegun.sqs """
    *** *** };
    [/QUOTE]<span id='postcolor'>
    Ok we know you can call a script.

    And i know you can script an event within the CPP without calling a script&#33;

    But the problem I have is how do you add your scripted event into the "CLASS Eventhandler", I know it&#39;s done by the
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> addEventHandler &#91;&#34;foldwings&#34;,{}&#93;[/QUOTE]<span id='postcolor'>

    But where does this sit in the CPP, is in the "cfgvehicle" or somewhere else??

    This is what I&#39;ve got at the moment, just waiting to figure-out the "addeventhandler" problem.

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">class EventHandlers
    {gear = &#34;if &#40;_this Select 1&#41; then {&#40;_this Select 0&#41; Animate &#91;&#34;&#34;LtGear&#34;&#34;, 0&#93;; &#40;_this Select 0&#41; Animate &#91;&#34;&#34;RtGear&#34;&#34;, 0&#93;; &#40;_this Select 0&#41; Animate &#91;&#34;&#34;NoseGear&#34;&#34;, 0&#93;} else {&#40;_this Select 0&#41; Animate &#91;&#34;&#34;LtGear&#34;&#34;, 1&#93;; &#40;_this Select 0&#41; Animate &#91;&#34;&#34;RtGear&#34;&#34;, 1&#93;; &#40;_this Select 0&#41; Animate &#91;&#34;&#34;NoseGear&#34;&#34;, 1&#93;}&#34;;



    foldwings = &#34;if &#40;_this Select 1&#41; then {&#40;_this Select 0&#41; Animate &#91;&#34;&#34;Ltouterwing&#34;&#34;, 0&#93;; &#40;_this Select 0&#41; Animate &#91;&#34;&#34;Rtouterwing&#34;&#34;, 0&#93;} else {&#40;_this Select 0&#41; Animate &#91;&#34;&#34;Ltouterwing&#34;&#34;, 1&#93;; &#40;_this Select 0&#41; Animate &#91;&#34;&#34;Rtouterwing&#34;&#34;, 1&#93;}&#34;;
    };};
    };[/QUOTE]<span id='postcolor'>


    Once I know this I can finish the folding wings and the tailhook for my model.

    DragoFire



    Just another tragic case of terminal kinetic energy poisoning&#33;

    It&#39;s hard to please everyone, but easy to upset everyone&#33;

  4. #4
    Staff Sergeant
    Join Date
    Jan 9 2002
    Location
    Poland - Bytom
    Posts
    363
    You mean this is a line from config.cpp ? If yes, i can use VTOL script in "INIT" . Cool.
    \"We hope you enjoyed FFUR\" --&#62; I did &#33;

  5.   Click here to go to the next Developer post in this thread.   #5
    BI Developer Suma's Avatar
    Join Date
    Jun 27 2001
    Location
    Czech Republic
    Posts
    3,708
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (DragoFire @ Dec. 10 2002,08:09)</td></tr><tr><td id="QUOTE">This is what I&#39;ve got at the moment, just waiting to figure-out the "addeventhandler" problem.

    Once I know this I can finish the folding wings and the tailhook for my model.[/QUOTE]<span id='postcolor'>
    You can add event handlers only for events that are known by the game engine. List of those is available in command reference (Scripting topics).

    You can also implement your own "custom" animations bound to action menu. This has been discussed in several topics already. Now please let this topic go back to its original topic, and it is "Multiple scripts run from one event handler". If you have questions regarding other topics, feel free to create a new topic.

  6. #6
    The "addeventhandle" has been around since 1.85 as I understand, but I can&#39;t seem to find where it goes in the CPP.

    Once it&#39;s found, I&#39;d say there will be a lot of people adding custom animations with their own action commands.

    DragoFire

  7. #7
    0--></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Suma @ Dec. 10 2002,090)</td></tr><tr><td id="QUOTE">You can add event handlers only for events that are known by the game engine. List of those is available in command reference (Scripting topics).[/QUOTE]<span id='postcolor'>
    Ok, this is somewhat confusing; Since your saying that we can only use event handlers that the engine nows and that all of those are listed in the Comref. Well, where did DragoFire get his "foldwings"-event from then? I cant find that ***in the ComRef?

    Or is that event somewhat derived from the event signaling engine on/off?

    brsseb

  8.   Click here to go to the next Developer post in this thread.   #8
    BI Developer Suma's Avatar
    Join Date
    Jun 27 2001
    Location
    Czech Republic
    Posts
    3,708
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (brsseb @ Dec. 10 2002,14:17)</td></tr><tr><td id="QUOTE">Ok, this is somewhat confusing ... Well, where did DragoFire get his "foldwings"-event from then? I cant find that ***in the ComRef?[/QUOTE]<span id='postcolor'>
    Yes, it is confusing. I will try to make it clear. DragoFire got his "foldwings" from thin air and he is now surprised it is not working. Now the confusion grows, because some people start to think he got it working. No, he did not.

    The confusion will be completely solved once DragoFire realizes he can do his folding wings using custom animation, not using event handler.

  9. #9
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Suma @ Dec. 10 2002,15:47)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (brsseb @ Dec. 10 2002,14:17)</td></tr><tr><td id="QUOTE">Ok, this is somewhat confusing ... Well, where did DragoFire get his "foldwings"-event from then? I cant find that ***in the ComRef?[/QUOTE]<span id='postcolor'>
    Yes, it is confusing. I will try to make it clear. DragoFire got his "foldwings" from thin air and he is now surprised it is not working. Now the confusion grows, because some people start to think he got it working. No, he did not.

    The confusion will be completely solved once DragoFire realizes he can do his folding wings using custom animation, not using event handler.[/QUOTE]<span id='postcolor'>
    Thank god for that. Though I had missed out on something big there. Btw, any chance for move event handlers in the next few patches?

    brsseb

  10. #10
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (brsseb @ Dec. 11 2002,03:55)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Suma @ Dec. 10 2002,15:47)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (brsseb @ Dec. 10 2002,14:17)</td></tr><tr><td id="QUOTE">Ok, this is somewhat confusing ... Well, where did DragoFire get his "foldwings"-event from then? I cant find that ***in the ComRef?[/QUOTE]<span id='postcolor'>
    Yes, it is confusing. I will try to make it clear. DragoFire got his "foldwings" from thin air and he is now surprised it is not working. Now the confusion grows, because some people start to think he got it working. No, he did not.

    The confusion will be completely solved once DragoFire realizes he can do his folding wings using custom animation, not using event handler.[/QUOTE]<span id='postcolor'>
    Thank god for that. Though I had missed out on something big there. Btw, any chance for move event handlers in the next few patches?

    brsseb[/QUOTE]<span id='postcolor'>
    What had happen is a follows.

    Due to the major LACK of information about CPP scripting, in regards to eventhandles and animations, other than what some of us have found, by trial and error. I went looking for anything that might allow me to add a event to my model.

    The only thing I found that looked like it might work was the "addeventhandle", but is listed was in the comref at www.flashpoint1985.com . It made sense to me that this could allow you to add a "NEW" "eventhandle" to a model&#39;s CPP, as there is no where is says it isn&#39;t possible. But from what Suma&#39;s saying this isn&#39;t true.

    I&#39;ve been talking to a large number of mod/modelmakers about the CPP and it&#39;s still a big unknown to most of us, a few of us know a large amount about areas of the CPP, but not the complete CPP setup in great detail.

    If possible Suma can you provide us (being the Modelmakers/ModMakers) a better defined guide to the model&#39;s CPP configation, I know this maybe a big ask, but I don&#39;t know anyone who has a full and complete knownledge of the CPP&#39;s, it&#39;s just been a guessing game so far, and I think it&#39;d go down great with everyone.

    I look forward to your feedback.

    DragoFire




Page 1 of 4 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •