Results 1 to 8 of 8

Thread: Editing a .dat file that has certain properties in it

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67
    Take a look at this .dat file from the game Swat 3 it includes infomation of a mission.

    mission111
    {
    Mission_Info
    {
    MapName Mission111
    ShortName Explosions Heard, East LA Warehouse
    Version 1.0
    Dot_X 300
    Dot_Y 270
    ShortDesc Explosions Heard
    ShortDesc_Type MissName_bottL
    ShortDesc_Top 290
    ShortDesc_Left 280
    ShortDesc_Bottom 290
    ShortDesc_Right 280
    ShortDesc_PicLeft 60
    ShortDesc_PicTop 201
    Estab_Bmp Estab_Mission111


    [FullDesc]
    MISSION OBJECTIVES \nEvacuate Civilians \nLocate where bombs are coming from \nArrest the Suspect \n\nSee below for detail information...\n\nExplosions Heard \nA warehouse on the east side of LA, where bombs have been heard, Workers say its coming from inside the stairs. \n\nADDITIONAL INFORMATION \nNot know who the bomber is but so far nobody has been hurt. \n\nDIGNITARY INFORMATION \nDignitaries are workers of the warehouse no serious threat to them at this time, it has been advised to evacuate them
    [End]

    LoadingText Explosions Heard \nEast LA Warehouse

    }

    // Entrypoints must be in the same order as in the level...
    Entrypoints
    {
    // Entrypoint Name
    // ---------- ----
    0 Main Area / Level 1
    }

    // see maps.dat for description. note that the estab. text name must be "Loading_" + mapname.
    MapLoadData
    {
    // Map Entry # Training Estab. bitmap Estab. Text Stealth Music Dynamic Music Slides
    // --- ------- -------- ------------- ----------- ------------- ------------- ------
    Mission111 0 0 Loading_MissionH Loading_MissionH Stealth1 Dynamic1 (D5,D7,D9,D1,N1)
    //Mission H, entry #0 interior lobby of theater. " Lobby Vestibule / Chang's Chinese Theater "
    }

    // see maps.dat for description.
    Maps
    {
    // Map Timeframe Leader Red1 Red2 Blue1 Blue2 Medals Playable ShortName SmallEstabBmp
    // --- --------- ------ ---- ---- ----- ----- ------ -------- --------- -------------
    Mission111 0 (mp5,10,10,5) (mp5,10,10,5) (mp5,10,10,5) (mp5,10,10,5) (mp5,10,10,5) (1,1,1,1) 1 Mission111ShortName Create_Estab_Mission111
    }

    }

    it might look messed up
    But I want to be able to make a program that will edit the properties of this automaticly without having to open it in notepad and messing it up!
    Frankie Weindel
    VB 6 Learning Edtion SP3

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    In short, you have to parse out all data you want using mid on the specific locations, by finding the tags or delimiters you know that won't change.

    To find the tags use INstr$ or split
    To get the date between two tags/delimiters use Mid$ function
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67
    huh?
    Can you explain that a little more better?
    Frankie Weindel
    VB 6 Learning Edtion SP3

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Let's take an example, you want to parse out "Mission_Info" from:
    Code:
    mission111 
    { 
    Mission_Info 
    {
    To do that you need to find both "{", and you can do it with Instr:

    Code:
    pos = 0
    pos = InStr$(pos + 1, Text, "{")
    starttag = pos
    pos = InStr$(pos + 1, Text, "{")
    endtag = pos
    Data = Mid$(starttag + 1, endtag - starttag - 1)
    Remember if you continue to search from that pos, keep the pos variable, don't change it anywhere since instr will use it to determine where to search next. The last argument you pass in Instr is what you search for.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67
    how would I go about replacing the different values stored in the dat?
    Frankie Weindel
    VB 6 Learning Edtion SP3

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Add up all parts you parsed into pieces with & operator, for instance for:
    Code:
    mission111 
    { 
    Mission_Info 
    {
    do:
    Code:
    Text="mission111 " & vbcrlf & "{" & vbcrlf & TheDataYouveChanged & vbcrlf & "{"
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67
    Now how do you put it into the .dat?
    Frankie Weindel
    VB 6 Learning Edtion SP3

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Code:
    Open "C:\test.dat" for Binary as 1
        put#1,,Text
    Close 1
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

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



Click Here to Expand Forum to Full Width