Results 1 to 13 of 13

Thread: Script "alias"

  1. #1
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Script "alias"

    An old campaign (~2011/12) have this:

    Code:
    private static string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    private static string FILE_NAME = mydocpath + @"\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\campaign_Battle_of_France\Score.data";
    Since campaign is now in "documents\...\custom" I try with

    Code:
    @"\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Battle_of_France"
    and

    Code:
    @"D:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Battle_of_France"
    But get (in game) an "file path error".

    Better explained there: https://theairtacticalassaultgroup.c...l=1#post365505
    Last edited by 1lokos; Oct-14-2020 at 17:23.

  2. #2
    ATAG_Colander's Avatar
    Join Date
    Nov 2011
    Location
    Bir Tawil
    Posts
    11,128
    Post Thanks / Like
    Total Downloaded
    255.73 MB

    Re: Script "alias"

    Aren't you missing the "Score.data" at the end?

  3. #3
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Script "alias"

    No. I just don't past this part there, in updated script are OK, is

    Code:
    @"\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Battle_of_France\Score.data";

  4. #4
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Script "alias"

    It seems that the problem is due to my "Documents" folder being in "D:" the script looks in "C:"

    my long term personal goals

    What certainly is defined in game code...
    Last edited by 1lokos; Oct-14-2020 at 14:06.

  5. #5
    ATAG_Colander's Avatar
    Join Date
    Nov 2011
    Location
    Bir Tawil
    Posts
    11,128
    Post Thanks / Like
    Total Downloaded
    255.73 MB

    Re: Script "alias"

    "Environment.GetFolderPath(Environment.SpecialFold er.MyDocuments)" is supposed to return the user's "my documents" folder.
    Seems like if you are forgetting the second line that adds the "my documents" path to the rest.

    BTW, what is that propaganda link in your post?????

  6. #6
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Script "alias"

    The link is Postimage marketing thing.

    This script has two parts, first write in "score.data" file, how it was before - with campaign files in SteamApps; is ahead \\

    Code:
    public class Mission : maddox.game.campaign.Mission
    {
        AiActor a1 = null;
        AiAircraft airc1 = null;
        int countPlayerWins = 0;
        int countDead = 0;
        bool isComplete = false;
        int score = 0;
    
        private static string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        private static string FILE_NAME = mydocpath + @"D:\Documentos\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_test\Score.data";
      //private static string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
      //private static string FILE_NAME = mydocpath + @"\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\campaign_Battle_of_France\Score.data";
    And the second part, write in the next mission briefing file.

    Code:
       if (isComplete)
            {
                writeScore(score);
    
                BriefingParser parser = new BriefingParser(@"D:\Documentos\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_test\Test_01.BRIEFING");
                parser.AddSetting("2", "Description", "Your score : ", readScore().ToString());
    
     // BriefingParser parser = new BriefingParser(@"..\il-2 sturmovik cliffs of dover\parts\bob\mission\campaign\campaign_Battle_of_France\GB_12.BRIEFING");
     // parser.AddSetting("2", "Description", "Your score : ", readScore().ToString());
    		 	 {
                writeScore(score);          
                             }
              }
    For don't mess with original files, I set a "test campaign".

    And the error became: "Object Reference Not Set To An Instance Of An Object" .... "(String, Int32)"
    Last edited by 1lokos; Oct-14-2020 at 14:44.

  7. #7
    ATAG_Colander's Avatar
    Join Date
    Nov 2011
    Location
    Bir Tawil
    Posts
    11,128
    Post Thanks / Like
    Total Downloaded
    255.73 MB

    Re: Script "alias"

    Quote Originally Posted by 1lokos View Post
    If I use a D:\ reference, in the second line:

    Code:
     private static string FILE_NAME = mydocpath + @"D:\Documentos\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_test\Score.data";
    The error became for the second part of script - write in briefing file:

    Code:
    BriefingParser parser = new BriefingParser("D:\Documentos\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_test\Test_01.BRIEFING");
    parser.AddSetting("2", "Description", "Your score : ", readScore().ToString());
    "Leave (or exit/output) sequence not recognized."

    The link is Postimage marketing thing.


    Add the missing @ at the beginning, otherwise you would have to escape the \ with another \ like this "D:\\xxxx\\xxxx\\aaaa.data"

  8. #8
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Script "alias"

    End that the issue is not in the "alias" (@) - is need use the reference to "*\Documents\1c...." (* partition letter: C, D...) , but in the score.data file.

    I make work (more or less) changing:

    Score.data for Mission1.data, Mission2 data, etc, if leave only one "Score.data", at start of second mission say that file was already used.

    Now the briefing is updated at end of mission, but for some reason after fly 3 missions the score appear in two lines:



    Part of the briefing file that is updated [2]

    [2]
    <Name>
    Success
    <Description>
    Good job!
    Your score : 100
    Your score : 100
    <Slide>
    Test-OK.jpg
    <Caption>
    That result "100 points" at end of missions don't worth the effort with this script. Very fool.

  9. #9
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Script "alias"

    Back to the original question, the "@".

    I solve my problem with the script path pointing to "D:\Documentos\1C..."

    But if I upload this campaign this will can be problem for people with "Documents" folder in C:\, E:\, etc.

    I notice that campaigns missions are loaded from

    $user/mission/campaign/custom/...



    This "$user/" can't be applied for scripts, for avoid the above issue?

  10. #10
    ATAG Member ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    986
    Post Thanks / Like
    Total Downloaded
    908.31 MB

    Re: Script "alias"

    Quote Originally Posted by 1lokos View Post
    Back to the original question, the "@".

    I solve my problem with the script path pointing to "D:\Documentos\1C..."

    But if I upload this campaign this will can be problem for people with "Documents" folder in C:\, E:\, etc.

    I notice that campaigns missions are loaded from

    $user/mission/campaign/custom/...



    This "$user/" can't be applied for scripts, for avoid the above issue?


    static string USER_DOC_PATH = Environment.GetFolderPath(Environment.SpecialFolde r.MyDocuments);
    static string MISSION_PATH = USER_DOC_PATH + "/1C SoftClub/il-2 sturmovik cliffs of dover/missions/Single/yourMissionName/";


    Check this code. USER_DOC_PATH will have the correct drive letter, C: or D: or whatever.

  11. #11
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Script "alias"

    No luck for a while

    Your example is for missions/single/ folder.

    And for mission/campaign/custom/ folder?

    The original script - working, but create the partition letter (C:\ D:\...)issue:

    Code:
          private static string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
          private static string FILE_NAME = mydocpath + @"..\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_test\Test_01.data"
    Without this "private" the following parts of string is broken, too without "FILE_NAME" in the second line, in your is "MISSION_PATH". "FILE_NAME" is used in other strings.


    I try with this modifications, need add the "@":
    Code:
    private static string USER_DOC_PATH = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    private static string FILE_NAME = USER_DOC_PATH + @"/1C SoftClub/il-2 sturmovik cliffs of dover/mission/custom/campaign_test/Test_01.data";
    Without the "@" get this error: "System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)"

    The script is working, the success/failure of mission (of campaign) is reported. But the "score" (data file) is not updated, is working OK with the original lines.
    Last edited by 1lokos; Oct-15-2020 at 19:31.

  12. #12
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Script "alias"

    This work:

    Code:
    private static string USER_DOC_PATH = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);	
    private static string FILE_NAME = USER_DOC_PATH + "..\\1C SoftClub\\il-2 sturmovik cliffs of dover\\mission\\campaign\\custom\\campaign_test\\Test_01.data";
    But for the second part - briefing update, I need keep "D:\Documents" (D:\ in my case) reference.

    Code:
    BriefingParser parser = new BriefingParser("D:\\Documentos\\1C SoftClub\\il-2 sturmovik cliffs of dover\\mission\\campaign\\custom\\campaign_test\\Test_01.BRIEFING");
    parser.AddSetting("2", "Description", "Your evaluation note : ", readScore().ToString());
    Any other combination without this reference and \ or /, or //, with @ or without... get this error mixing old and new path:

    "System.IO.DirectoryNotFoundException: Could not find part of the path 'C:\Program Files (x86)\Steam\steamapps\common\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_test\Test_01.BRIEFING'.
    in BriefingParser..ctor(String briefingPath)

    So back to square one.
    Last edited by 1lokos; Oct-15-2020 at 22:16.

  13. #13
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Script "alias"

    Quote Originally Posted by 1lokos View Post
    But for the second part - briefing update, I need keep "D:\Documents" (D:\ in my case) reference.

    Code:
    BriefingParser parser = new BriefingParser("D:\\Documentos\\1C SoftClub\\il-2 sturmovik cliffs of dover\\mission\\campaign\\custom\\campaign_test\\Test_01.BRIEFING");
    parser.AddSetting("2", "Description", "Your evaluation note : ", readScore().ToString());
    "Better latte than never."

    Solve the second part.

    Code:
                BriefingParser parser = new BriefingParser(@USER_DOC_PATH + "..\\1C SoftClub\\il-2 sturmovik cliffs of dover\\mission\\campaign\\custom\\campaign_test\\Test_01.BRIEFING");
             	parser.AddSetting("2", "Description", "Score :", readScore().ToString());
            }
        }
    }

Bookmarks

Posting Permissions

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