Raimonds

test.fsm

Jun 4th, 2015
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.06 KB | None | 0 0
  1. /*%FSM<COMPILE "F:\FSM Editor Personal Edition\scriptedFSM.cfg, tut">*/
  2. /*%FSM<HEAD>*/
  3. /*
  4. item0[] = {"init",0,250,-48.772354,-125.615723,41.227634,-75.615761,0.000000,"init"};
  5. item1[] = {"delay",4,218,13.300671,85.187050,103.300690,135.187073,0.000000,"delay"};
  6. item2[] = {"end",1,250,263.887787,-120.017616,353.887787,-70.017586,0.000000,"end"};
  7. item3[] = {"Connecting",2,250,-47.202316,17.096188,42.797699,67.096191,0.000000,"Connecting"};
  8. item4[] = {"client",4,218,-47.372559,-61.222324,42.627441,-11.222324,0.000000,"client"};
  9. item5[] = {"delay",4,218,-98.342255,81.716270,-8.342241,131.716309,0.000000,"delay"};
  10. item6[] = {"attempts",2,250,-54.314095,168.426575,35.685921,218.426575,0.000000,"attempts"};
  11. item7[] = {"connected",4,218,-52.578724,231.478821,37.421276,281.478821,0.000000,"connected"};
  12. item8[] = {"",7,210,304.839844,254.332092,312.839844,262.332062,0.000000,""};
  13. item9[] = {"server",4,218,90.366852,-124.104118,180.366837,-74.104111,0.000000,"server"};
  14. item10[] = {"server_end",1,250,90.006142,-226.366333,180.006195,-176.366348,0.000000,"server end"};
  15. item11[] = {"too_many_attempt",4,218,125.017967,112.780563,215.017990,162.780563,0.000000,"too many" \n "attempts"};
  16. item12[] = {"",7,210,167.497955,2.328092,175.497925,10.328063,0.000000,""};
  17. link0[] = {0,4};
  18. link1[] = {0,9};
  19. link2[] = {1,3};
  20. link3[] = {3,5};
  21. link4[] = {4,3};
  22. link5[] = {5,6};
  23. link6[] = {6,1};
  24. link7[] = {6,7};
  25. link8[] = {6,11};
  26. link9[] = {7,8};
  27. link10[] = {8,2};
  28. link11[] = {9,10};
  29. link12[] = {11,12};
  30. link13[] = {12,2};
  31. globals[] = {0.000000,0,0,0,0,640,480,1,14,6316128,1,-178.642654,477.938232,529.421509,-330.925720,957,1254,1};
  32. window[] = {0,-1,-1,-1,-1,1123,597,2517,94,1,975};
  33. *//*%FSM</HEAD>*/
  34. class FSM
  35. {
  36.   fsmName = "tut";
  37.   class States
  38.   {
  39.     /*%FSM<STATE "init">*/
  40.     class init
  41.     {
  42.       name = "init";
  43.       init = /*%FSM<STATEINIT""">*/"allowConnection = false;" \n
  44.        "_attempts = 0;" \n
  45.        ""/*%FSM</STATEINIT""">*/;
  46.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  47.       class Links
  48.       {
  49.         /*%FSM<LINK "server">*/
  50.         class server
  51.         {
  52.           priority = 0.000000;
  53.           to="server_end";
  54.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  55.           condition=/*%FSM<CONDITION""">*/"isDedicated"/*%FSM</CONDITION""">*/;
  56.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  57.         };
  58.         /*%FSM</LINK>*/
  59.         /*%FSM<LINK "client">*/
  60.         class client
  61.         {
  62.           priority = 0.000000;
  63.           to="Connecting";
  64.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  65.           condition=/*%FSM<CONDITION""">*/"!isDedicated"/*%FSM</CONDITION""">*/;
  66.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  67.         };
  68.         /*%FSM</LINK>*/
  69.       };
  70.     };
  71.     /*%FSM</STATE>*/
  72.     /*%FSM<STATE "end">*/
  73.     class end
  74.     {
  75.       name = "end";
  76.       init = /*%FSM<STATEINIT""">*/"systemchat format [""Time passed since start = %1, it took %2 attempts"",(diag_tickTime - _totalTime),_attempts];"/*%FSM</STATEINIT""">*/;
  77.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  78.       class Links
  79.       {
  80.       };
  81.     };
  82.     /*%FSM</STATE>*/
  83.     /*%FSM<STATE "Connecting">*/
  84.     class Connecting
  85.     {
  86.       name = "Connecting";
  87.       init = /*%FSM<STATEINIT""">*/"systemChat ""Connecting to a server"";" \n
  88.        "_initTime = diag_tickTime;"/*%FSM</STATEINIT""">*/;
  89.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  90.       class Links
  91.       {
  92.         /*%FSM<LINK "delay">*/
  93.         class delay
  94.         {
  95.           priority = 0.000000;
  96.           to="attempts";
  97.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  98.           condition=/*%FSM<CONDITION""">*/"(diag_tickTime -_initTime) > 3"/*%FSM</CONDITION""">*/;
  99.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  100.         };
  101.         /*%FSM</LINK>*/
  102.       };
  103.     };
  104.     /*%FSM</STATE>*/
  105.     /*%FSM<STATE "attempts">*/
  106.     class attempts
  107.     {
  108.       name = "attempts";
  109.       init = /*%FSM<STATEINIT""">*/"_attempts = _attempts + 1;" \n
  110.        "_totalTime = diag_tickTime + _this;" \n
  111.        "_initTime = diag_tickTime;"/*%FSM</STATEINIT""">*/;
  112.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  113.       class Links
  114.       {
  115.         /*%FSM<LINK "connected">*/
  116.         class connected
  117.         {
  118.           priority = 0.000000;
  119.           to="end";
  120.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  121.           condition=/*%FSM<CONDITION""">*/"allowConnection"/*%FSM</CONDITION""">*/;
  122.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  123.         };
  124.         /*%FSM</LINK>*/
  125.         /*%FSM<LINK "too_many_attempt">*/
  126.         class too_many_attempt
  127.         {
  128.           priority = 0.000000;
  129.           to="end";
  130.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  131.           condition=/*%FSM<CONDITION""">*/"_attempts > 5"/*%FSM</CONDITION""">*/;
  132.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  133.         };
  134.         /*%FSM</LINK>*/
  135.         /*%FSM<LINK "delay">*/
  136.         class delay
  137.         {
  138.           priority = 0.000000;
  139.           to="Connecting";
  140.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  141.           condition=/*%FSM<CONDITION""">*/"(diag_tickTime -_initTime) > 3"/*%FSM</CONDITION""">*/;
  142.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  143.         };
  144.         /*%FSM</LINK>*/
  145.       };
  146.     };
  147.     /*%FSM</STATE>*/
  148.     /*%FSM<STATE "server_end">*/
  149.     class server_end
  150.     {
  151.       name = "server_end";
  152.       init = /*%FSM<STATEINIT""">*/"diag_log ""i was a server yay"""/*%FSM</STATEINIT""">*/;
  153.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  154.       class Links
  155.       {
  156.       };
  157.     };
  158.     /*%FSM</STATE>*/
  159.   };
  160.   initState="init";
  161.   finalStates[] =
  162.   {
  163.     "end",
  164.     "server_end",
  165.   };
  166. };
  167. /*%FSM</COMPILE>*/
Advertisement
Add Comment
Please, Sign In to add comment