Latest topics

» Screenshots funny and serious :)
by Jamrom2 Today at 6:47 am

» Computer Overhaul
by frinik Today at 4:19 am

» New & Updated Models(Нові Моделі)
by will73 Yesterday at 5:45 pm

» Video from SF
by frinik Yesterday at 2:15 pm

» Місії на заказ/Mission request
by lockie Yesterday at 11:49 am

» Great pictures from the movies.
by woofiedog Sat Jul 22, 2017 8:38 pm

» Here's To Swimmin' With Bow Legged Women
by woofiedog Sat Jul 22, 2017 8:28 pm

» Effects. New textures. Experiments.
by woofiedog Sat Jul 22, 2017 1:07 pm

» Танк Пантера Д/А/Г/ Panther ausf.D,A,G
by frinik Sat Jul 22, 2017 4:12 am

July 2017

MonTueWedThuFriSatSun
     12
3456789
10111213141516
17181920212223
24252627282930
31      

Calendar Calendar


    Some words about scripting

    Share
    avatar
    lockie
    TSF Member
    TSF Member

    Posts : 3555
    Join date : 2014-07-24
    Age : 50
    Location : Ukraine, Kyiv

    Some words about scripting

    Post by lockie on Thu Sep 04, 2014 7:41 pm

    Here's a very useful operator "rem". Sometimes during mission adjusting, I need to keep some info for the any case purposes or just for explanation what I've done.
    But each time when I press "save" button in ME all info surrounded by symbol "//" disappeared.
    In such case I need "rem" operator. It works perfect! The grammar is: rem, text;
    I.e.
    ext, add_misobj, brief, fonar, 4, txt_brief_start, txt_ntlx_order;
    nop;
    rem, set up point of movement;
    ext, sel_waypoint, map_ambush_02, 0xfff7cd09, txt_fg_uni_amb_01, 0;
    ext, add_misobj, order1, fonar, 1, txt_ambush, txt_ambush_sh;
    ext, wait_tr, tr_usr_start_ger;
    ext, change_misobj, order1, 3;
    rem, wait "mission completed";
    wait_time, 15;
    ext, add_misobj, order2, fonar, 1, txt_smash_lg, txt_smash_sh;
    rem, first victory;
    ext, wait_tr, sov_vic;
    ext, change_misobj, order2, 3;
    wait_time, 15;
    ext, sel_waypoint, map_sov_vic_fin, 0xff802020, txt_fg_uni_fin, 0;
    ext, add_misobj, koltso, fonar, 1, txt_koltso_lg, txt_koltso_sh;
    rem, total superiority;
    ext, wait_tr, sov_vic_exec;
    ext, change_misobj, koltso, 3;
    wait_time, 15;
    avatar
    lockie
    TSF Member
    TSF Member

    Posts : 3555
    Join date : 2014-07-24
    Age : 50
    Location : Ukraine, Kyiv

    Re: Some words about scripting

    Post by lockie on Fri Sep 05, 2014 5:42 pm

    Here's another example how to use operator "goto". Sometimes we need to force unit moving along the same route, i.e. as training tank.
    Sample:
    test()
    {

    ext, ai_setstate, 0x1, 0;
    rem, comments: this is start label;
    label, cycle1;
    ext, ai_move, hs_01, false, -1, 15;
    ext, ai_move, hs_02, false, -1, 15;
    ext, ai_move, hs_03, false, -1, 15;
    ext, ai_move, hs_04, false, -1, 15;
    rem, comments: goto to the label to start from;
    goto, cycle1;
    }
    The grammar is simple. First specify "label" where start from, then make cycle with operator "goto" and our training tank will go without stop.
    avatar
    lockie
    TSF Member
    TSF Member

    Posts : 3555
    Join date : 2014-07-24
    Age : 50
    Location : Ukraine, Kyiv

    Re: Some words about scripting

    Post by lockie on Sat Sep 06, 2014 4:37 pm

    I discovered a very interesting feature of the operator "exit". Here's grammar:
    Code:
    ext, ai_exit, false;
    Where flag "false" does that only desant(passengers) will be taken out. In case of the flag "true" - the whole crew+desant will leave the unit. Of course, don`t apply this flag to the user`s unit or the game CTD Smile
    Well, this flag doesn't effect gameplay greatly, but for the mission atmosphere that one will be a fine feature.
    For example, we've tank broken engine or tank out of fuel or we need to force driver in attack. The last case does - motorized infantry on the truck came to the initial point to attack. We give commands: exit from truck, move to attack area.
    But, what we see? The trucks will go in attack(!), this is nonsense.
    That's why we need crew/driver to leave the tank/truck, then evacuate to the base/take part in attack.

    Here's explanation how flag "true" works in operator "exit".
    First, we've a tank M3 "Lee", where tank commander has been reported by driver that engine has broken and crew members subject to be evacuated.


    Commander made a mobile phone call to HQ with a request: May Day! We need a truck to get us the hell outta here!
    Doors opened:


    And all 6 crew members left the tank:


    Then all members ordered by commander in line to be sure - nobody left in the broken armored box.


    Move to the line order and wait for the truck support.


    Cavalry(truck squad) has arrived, then let's the hell outta here!


    Enter on the truck.


    Here we are!


    Let's go!


    It's a long way to the base, if u wanna Rock'N'Roll! (or at least - to finish the mission Smile


    Finally at home!


    Here's script of the sequence:

    i_divisions:divisions()
    {
    user_human(){eng_tnk01:AA, wp_gunner, 8;}

    divisions()
    {
    eng_tnk01, gbr_mtank02c, eng_p_usr1, -1, 2, sc_out, 1, 1, 1.0, 1.0, 1.0, 0x2, gbr_m4a2, 0.0;
    eng_auto, usa_platoon_truck1b, eng_p_truck, -1, 2, sc_truck, 1, 1, 1.0, 1.0, 1.0, 0x2, gbr_m4a2, 0.0;
    }
    }

    i_scriptman:scriptman()
    {
    dummy()
    {

    }

    sc_out()
    {

    rem, "script for the members crew of the M3 LEE";
    rem, "all members leave the tank";
    ext, ai_exit, true;
    rem, "order line";
    ext, ai_form, 0;
    ext, ai_setstate, 0x1, 0;
    ext, ai_move, eng_tac01, false, -1, 15;
    wait_time, 10;
    rem, "move to the truck";
    ext, ai_move, inf_in, false, -1, 15;
    rem, "enter in truck AA";
    ext, ai_enter, eng_auto:AA, true, -1, 15;
    }

    sc_truck()
    {

    rem, "script for the truck";
    ext, ai_form, 2,1,100;
    ext, ai_setstate, 0, 0x1;
    rem, "wait crew near truck";
    ext, wait_tr, wait_inf;
    wait_time, 30;
    rem, "move along the route";
    ext, ai_move, fin_01, false, -1, 15;
    ext, ai_move, fin_02, false, -1, 15;
    ext, ai_move, fin_03, false, -1, 15;
    }

    }


    i_trigman:trigman()
    {
    cs_artfire()
    {

    }

    cs_main()
    {

    }

    cs_map()
    {

    }

    cs_positions()
    {

    }


    triggers()
    {
    wait_inf, 0x20002, 8, inf_in;
    }
    }

    _vars() {}
    avatar
    Pointer

    Posts : 157
    Join date : 2015-04-18
    Location : Poland

    Re: Some words about scripting

    Post by Pointer on Sun May 17, 2015 6:27 pm

    Hello everybody,

    As a newcomer, I salute the STA team and all other people engaged in the process of improving and enriching "Steel Fury".
    Your good job is one more example of the power of the internet community.
    Thank you much and carry on!

    A few words about me.  I am 56 and live in Poland.  My adventure with computer games began in late 80's with ZX Spectrum.  The next one was Commodore Amiga.  The tank simulations are my favourite games, but not the first in line.  This position is occupied by flight simulations and "IL-2 Sturmovik" seems to be the game of my life.  Of course never say "never"...

    It's time for the essential part of my post.

    As I've understood, MaxFH asked about the possibility of diversification of executed script depending on the random place of born or the random destination of the previous movement.
    In the wider aspect, this is the question, how to implement the conditional instructions in the SF script language.  Due to the game manual there is no such commands, but "Repeat trigger" ( ext, loop_tr, <trigger>, <0/1>, <number-of-instructions>; ) is de facto the instruction of the conditional relatively addressed backward jump.  Tricky combination with the unconditional absolutely addressed jump ( goto, <label_name>; ) allows to implement typical conditional instructions.

    The templates are as follows:

    Code:


     rem Implementation of if-then programming scheme.;
     goto, @@if_01;
     goto, @@end_if_01;
     label, @@if_01;
     ext, loop_tr, <trigger>, 1, 2;
     rem Here instruction(s) for "then" (executed when <trigger> = true).;
     rem In the other case (when <trigger> = false) no action is performed.;
     label, @@end_if_01;



     rem Implementation of ifnot-then programming scheme.;
     goto, @@ifnot_02;
     goto, @@end_ifnot_02;
     label, @@ifnot_02;
     ext, loop_tr, <trigger>, 0, 2;
     rem Here instruction(s) for "then" (executed when <trigger> = false).;
     rem In the other case (when <trigger> = true) no action is performed.;
     label, @@end_ifnot_02;



     rem Implementation of if-then-else programming scheme.;
     goto, @@if_03;
     goto, @@else_03;
     label, @@if_03;
     ext, loop_tr, <trigger>, 1, 2;
     rem Here instruction(s) for "then" (executed when <trigger> = true).;
     goto, @@end_if_03;
     label, @@else_03;
     rem Here instruction(s) for "else" (executed when <trigger> = false).;
     label, @@end_if_03;




    It works.  An example here:

    http://sendfile.pl/pokaz/354537---cZTI.html

    This is a rework of the single standard mission "Krasny Gigant 18-May-1942".
    The player starts the mission at a random location (there are 2 possibilities).  If born at the western location, his tank is fully armed and ready for action.  In the other case (born at the eastern location), the player's tank is short of ammo and a visit to the ammo supply column (placed in the nearby forest) is recommended.
    Attention: do not use the orders menu on the tactic map screen (this terminates the player's unit script execution).  Also <Game options>/<Realism settings>/<Do as I do!> must be unchecked (the same reason).
    avatar
    lockie
    TSF Member
    TSF Member

    Posts : 3555
    Join date : 2014-07-24
    Age : 50
    Location : Ukraine, Kyiv

    Re: Some words about scripting

    Post by lockie on Sun May 17, 2015 6:51 pm

    Pointer wrote:Hello everybody,
    As a newcomer, I salute the STA team and all other people engaged in the process of improving and enriching "Steel Fury".
    Hi, Pointer!
    U're welcome to our forum!

    My adventure with computer games began in late 80's with ZX Spectrum.
    That exactly happened with me. I've made ZX Spectrum by myself (it was Lviv variant) and my favorite game was "Exalon"  Cool

    Tricky combination with the unconditional absolutely addressed jump ( goto, <label_name>; ) allows to implement typical conditional instructions.
    That's AMAZING!
    That's exactly I wanted to do, but I didn't know how to realize command "if_no/else". I knew, it was possible, but it didn't occur to my mind how. This is great part of the code! My hat off to u!
    I'll check out er variant. Do u've any other missions? Would be interested to have a look Cool

    BTW
    if u've have experience in C++ there are many examples with scripting. I mean shaders. They are placed here:
    ...data\k42\loc_rus\effects

    There are some examples of the code:

    Code:
       if( ll > 1.0 )
          sc *= pow( ll, 0.8 );

       pos.xy *= sc;
       
    ////////////////

       if( depth > v_focal )
       {
          if( depth < v_focal_01 )
             b = (v_focal);
          else
             if( depth < v_focal_02 )
                b = ( depth2 );

       }
       
    //////////////////////
       if( dot( N, N ) > 0.1 )
       {
          float3 L = normalize( v_lig );
          float a = saturate( dot( L, N ) );
            final.rgb = final.rgb * ( a + v_amb );

       }
    It would be interesting to change some effects or create a new one, like "flame-thrower".
    Here's folder with "effects" data:
    www.4shared.com/rar/mfLD5GU6ba/effects.html


    Last edited by lockie on Mon May 18, 2015 1:05 am; edited 4 times in total
    avatar
    lockie
    TSF Member
    TSF Member

    Posts : 3555
    Join date : 2014-07-24
    Age : 50
    Location : Ukraine, Kyiv

    Re: Some words about scripting

    Post by lockie on Mon May 18, 2015 5:51 am

    That script for me as is a pure synthetic adrenaline for the exhausted soul Smile
    I'm still learning it and I've to confess that's absolutely incredible implementation of the operator "if (0/1) then else".
    This entry is a key to the whole script:
    ext, loop_tr, born_at_a01, 1, 2;

    It does, if trigger born_at_a01 switched on "1" (user in the contour tanksa_01), then we have to go the the storage (label, @@else_01) to refill armament, coz tank is near out of ammo.
    In case, if trigger born_at_a01 didn't switched (it has default "0" value, user in the contour tanksa_02), then our tank already has ammo and may refill the armament at the user's desire (label, @@loop_01).
    I'm involved into SF from the very beginning 2007. I started to make missions and scripting approximately in 2010. And I've to confess I've never met so beautiful decision how to use existent commands. Bravo!
    avatar
    Pointer

    Posts : 157
    Join date : 2015-04-18
    Location : Poland

    test script

    Post by Pointer on Thu May 21, 2015 10:05 pm

    Hi Lockie, hi all!

    It's nice you found my previous post ineresting.

    lockie wrote:That exactly happened with me. I've made ZX Spectrum by myself (it was Lviv variant) and my favorite game was "Exalon"  Cool

    My 8-bit hits were: "Fighter Pilot", "Tomahawk", "The Way of the Exploding Fist".

    Do u've any other missions? Would be interested to have a look Cool

    Here link to my 3 missions - that's all I have in present.

    http://sendfile.pl/pokaz/360753---Eh6i.html

    #1 - more advanced version of previously uploaded,
    #2 and #3 - 2 other variations of Krasny Gigant, classic, 100% linear.

    About #1: previous one was only demo, the random need of rearming wasn't composed into the mission scenario structure.
    Now it is: the need of visiting the ammo supply column appears (or not) as the "official" mission objective, has associated texts and the navigation icon. I think that's the final version.
    I had to solve an irritating, but interesting problem: how to diversify the mission script, because - unforunately - the conditional instruction mustn't be used there ( (ext, loop_tr, <trigger>, <0/1>, <number-of-instructions>; ) may be used only in unit scripts). In that case I've used the method of the selective blockade of parallel processes. Additionally I had to modify the triggers to properly control those multiplied mainscripts.

    if u've have experience in C++ there are many examples with scripting. I mean shaders. They are placed here:
    ...data\k42\loc_rus\effects

    I have very small experience with C/C++.
    And the specified folder doesn't exists in my instalation of SF. It seems, that this part of my game is unmoded and dedicated files stayed unzipped in the archives.


    Here's folder with "effects" data:
    www.4shared.com/rar/mfLD5GU6ba/effects.html

    Thx. That's easier than extracting those non-standard archives.

    lockie wrote:ext, loop_tr, born_at_a01, 1, 2;

    It does, if trigger born_at_a01 switched on "1" (user in the contour tanksa_01), then we have to go the the storage (label, @@else_01) to refill armament, coz tank is near out of ammo.
    In case, if trigger born_at_a01 didn't switched (it has default "0" value, user in the contour tanksa_02), then our tank already has ammo and may refill the armament at the user's desire (label, @@loop_01).

    Sorry, but the other way around:
    a) player in contour rus_tanksa_01  --->  trigger  born_at_a01 = true  (numerically 1)  --->  initial full ammo state  (action "then"),
    b) player in contour rus_tanksa_02  --->  trigger  born_at_a01 = false (numerically 0)  --->  initial short ammo state (action "else").


    Finally one sugestion.
    Last time I didn't notice that exists the dedicated topic:
    http://stasf2008.ephpbb.com/t80-some-words-about-scripting

    Are you the moderator? Could you move our dialogue there? It would be easier accessible for non-cyrylic readers.

    Moved.
    22.05.2015
    lockie
    avatar
    lockie
    TSF Member
    TSF Member

    Posts : 3555
    Join date : 2014-07-24
    Age : 50
    Location : Ukraine, Kyiv

    Re: Some words about scripting

    Post by lockie on Fri May 22, 2015 5:16 pm

    Pointer wrote:
    Here link to my 3 missions - that's all I have in present.
    Hi, Pointer!
    I've looked over er advanced script and I've to say it's incredible! This is excellent work! BUT there is a HUGE problem. The matter is that mission "Krasny Giganit" is completely exhausted. I mean it is demo-mission, so any user already overplayed with this mission to the the boring death. Each time when he see "Krasny Gigant" he knows every details of the mission and even the new script will not bring much new air/immersion.
    So, what abt. idea to make a new mission on the base of the current script?
    I.e.:
    It is summer 1943 year. There is a Tiger platoon(3x) with infantry and a couple Pz.III N, which abt. to attack a village occupied with enemy. The tasks are:
    - capture the village
    - repel the enemy counter-attack
    I mean, scenario(and script) will be the same. There will be only a new polygon and a new name of the village. What du u think?
    avatar
    Pointer

    Posts : 157
    Join date : 2015-04-18
    Location : Poland

    Re: Some words about scripting

    Post by Pointer on Sat May 23, 2015 12:10 am

    Hi Lockie!

    When I wrote "I think that's the final version" I meant that is no more anything to do with this mission.
    That's all. I didn't suggest to treat it as "new mission" and insert it into any GMP.

    But just in that moment following idea occured to me:
    In the stock game (and also in STA 1.0) "Krasny Gigant" mission exist twice:
    one as the mission #3 of the Soviet campaign, and the second in "Single" section.
    The difference between them is very, very small.
    I think that they should differ a bit more and my mission is a good replacer of that "single".
    I know, that "stock" missions are sth like "holy cow". But in the past the modders did already changes to "stock" missions: for example the single "Zavodi" mission in the stock game is for the Matilda, and in STA 1.0 for the KV-1.

    So what do you think about placing my mission not in the GMP, but in the incoming STA Update?
    And of course NOT INSTEAD creating a new mission with the advanced scripting.

    lockie wrote:It is summer 1943 year. There is a Tiger platoon(3x) with infantry and a couple Pz.III N, which abt. to attack a village occupied with enemy. The tasks are:
    - capture the village
    - repel the enemy counter-attack
    I mean, scenario(and script) will be the same. There will be only a new polygon and a new name of the village. What du u think?

    I have 2 remarks:

    1. Rearming is in the unsolvable conflict with using the orders menu on the tactical map screen. So the player's unit must be a single tank.

    2. And general remark. The player does what he wants. The script of the player's unit may be "dummy". The real power of the advanced scripting is reserved to the AI units scripts. It's possible to create missions of the category "The strength (supported by AI) is on the opposite side. The player has to use his brain".
    avatar
    lockie
    TSF Member
    TSF Member

    Posts : 3555
    Join date : 2014-07-24
    Age : 50
    Location : Ukraine, Kyiv

    Re: Some words about scripting

    Post by lockie on Sat May 23, 2015 9:06 am

    Pointer wrote:
    I think that they should differ a bit more and my mission is a good replacer of that "single".
    So what do you think about placing my mission not in the GMP, but in the incoming STA Update?
    This is good idea! I'll replace "single" mission with a new variant.
    EDIT:
    I didn't find the second variant of the mission. Suppose, the variant from the "single" it is original one. I think we can make the next trick: I'll add the new variants to update:
    1. "Krasny Gigant 2"
    2. "Krasny Gigant 3"
    3. "Krasny Gigant 4"
    I think for the German side we may change the name of the mission, i.e.: Big battle, Iron Fist, The way of panzer, Fierce panzer etc.

    the single "Zavodi" mission in the stock game is for the Matilda, and in STA 1.0 for the KV-1.
    Then I think Matilda should be recovered.

    1. Rearming is in the unsolvable conflict with using the orders menu on the tactical map screen. So the player's unit must be a single tank.
    Yeap, u're right.

    2. The real power of the advanced scripting is reserved to the AI units scripts. It's possible to create missions of the category "The strength (supported by AI) is on the opposite side. The player has to use his brain".
    It sounds interesting!

    EDIT:
    I've put in all three missions. They don't request a big space and has some original script features. So, it'll be a good deal to include all of them.
    Here's another version of the "Fix_May":
    www.4shared.com/rar/qZBXWKx4ce/f07_Fix_MayUpd_2015.html

    Installation:
    1. Steel Sound Mod 1.0 (SSM)
    2. STA 1.0
    3. GMP1.x (optional)
    4. GMP2.x (optional)
    5. GMP3.x (optional)
    6. FebUpd_2015
    7. u07_Fix_MayUpd_2015

    Check them out and tell me does it suit or not.
    I named them as:
    - Krasny Gigant 2, 18 May 1942 (T-34)
    - May 1942, Big Battle (T-34)
    - May 1942, Fierce panzer (Pz.IV F2)
    avatar
    Pointer

    Posts : 157
    Join date : 2015-04-18
    Location : Poland

    Re: Some words about scripting

    Post by Pointer on Tue May 26, 2015 9:26 am

    Hi Lockie,

    lockie wrote:
    I've put in all three missions.

    Thanks you much. I'm really honoured.


    Check them out and tell me does it suit or not.

    Please use following names:

    missn_krgigant_t34()//01
    { Kr.Gigant, May'42, Give Us Ammo! (T-34); }
    missn_krgigant_battle_t34()//02
    { Kr.Gigant, May'42, Big Hard Battle (T-34); }
    missn_krgigant_panzer_pz4f2()//03
    { Kr.Gigant, May'42, Roles-swap (Pz.IV F2); }


    And please restore in all *.level files weather settings to:

    weather_file = weather\weather3.engcfg;

    unless your modification was intentional?
    avatar
    lockie
    TSF Member
    TSF Member

    Posts : 3555
    Join date : 2014-07-24
    Age : 50
    Location : Ukraine, Kyiv

    Re: Some words about scripting

    Post by lockie on Tue May 26, 2015 5:51 pm

    Pointer wrote:
    Thanks you much. I'm really honoured.
    U're welcome!  cheers

    Please use following names:
    missn_krgigant_t34()//01
    { Kr.Gigant, May'42, Give Us Ammo! (T-34); }
    missn_krgigant_battle_t34()//02
    { Kr.Gigant, May'42, Big Hard Battle (T-34); }
    missn_krgigant_panzer_pz4f2()//03
    { Kr.Gigant, May'42, Roles-swap (Pz.IV F2); }
    OK.

    And please restore in all *.level files weather settings to:
    weather_file = weather\weather3.engcfg;
    unless your modification was intentional?
    I wasn't sure that "weather3" had wind effect, that's why I've changed weather type. OK, I'll restore original "weather3".

    Sponsored content

    Re: Some words about scripting

    Post by Sponsored content


      Current date/time is Mon Jul 24, 2017 1:39 pm