Tutorial - how to decompile script

Discussion in 'Fallout General Modding' started by modmaker, May 24, 2006.

  1. modmaker

    modmaker First time out of the vault

    73
    Apr 2, 2006
    I used as example iipit.int script.
    Open FSE, decompile the script.

    Now you've got something like this:
    Code:
    variable ProtoOfItemGiven := 0;
    variable ValueOfRollCheck := 1;
    variable Scenery_Creation := 0;
    variable Scenery_Creation_Hex := 0;
    variable Scenery_Creation_Count := 0;
    variable Temp_Scenery_Creation_Hex := 0;
    variable Scenery_Creation_Ptr := 0;
    variable How_Many_Party_Members_Are_Injured := 0;
     variable How_Many_Party_Members_Armed := 0;
    variable PartyHealingItem := 0;
    
    procedure checkPartyMembersNearDoor;
    
    variable global_temp := 0;
    variable dest_tile := 0;
    variable step_tile := 0;
    variable in_dialog := 0;
    variable forced_node := 0;
    variable restock_amt := 0;
    variable restock_obj := 0;
    variable restock_trash := 0;
    variable removed_qty := 0;
    
    procedure start;
    procedure spatial_p_proc;
    procedure look_at_p_proc;
    procedure description_p_proc;
    procedure DumpPoorBastard;
    
    procedure checkPartyMembersNearDoor
    begin
      if (op_party_member_obj(16777278) != 0) then
      begin
        if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777278)) <= 5) then
          return(1);
      end
      if (op_party_member_obj(16777376) != 0) then
      begin
        if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777376)) <= 5) then
          return(1);
      end
      if (op_party_member_obj(16777377) != 0) then
      begin
        if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777377)) <= 5) then
          return(1);
      end
      if (op_party_member_obj(16777305) != 0) then
      begin
        if (op_tile_distance_objs(op_self_obj(), op_party_member_obj(16777305)) <= 5) then
          return(1);
    
    // ....... 
    No, this isn't compileable script. Only errors, errors and again errors.


    Delete this:
    Code:
    variable ProtoOfItemGiven := 0;
    variable ValueOfRollCheck := 1;
    variable Scenery_Creation := 0;
    variable Scenery_Creation_Hex := 0;
    variable Scenery_Creation_Count := 0;
    variable Temp_Scenery_Creation_Hex := 0;
    variable Scenery_Creation_Ptr := 0;
    variable How_Many_Party_Members_Are_Injured := 0;
    variable How_Many_Party_Members_Armed := 0;
    variable PartyHealingItem := 0;
    
    procedure checkPartyMembersNearDoor;
    
    variable global_temp := 0;
    variable dest_tile := 0;
    variable step_tile := 0;
    variable in_dialog := 0;
    variable forced_node := 0;
    variable restock_amt := 0;
    variable restock_obj := 0;
    variable restock_trash := 0;
    variable removed_qty := 0;
    Also delete procedure checkPartyMembersNearDoor.
    Code:
    procedure checkPartyMembersNearDoor
    begin
         // ............ looooong procedure
    end 
    Ok now it is much better :wink:

    Go to Edit --> Find and replace.
    Code:
    Find:          _op
    Replace      (this leave empty)
    Click "replace all".

    Do the same...
    Code:
    Find:          ()
    Replace      (this leave empty)
    

    Now it is compileable script. There are still some errors (#define,#include and so on), but it will never be better.


    This tutorial can be helpful for editing fo1 scripts.
     
  2. modmaker

    modmaker First time out of the vault

    73
    Apr 2, 2006
    anchorite:
    If you decompile a script, you always get something not-compileable. This is tutorial "How to decompile script and make it againg compileable" ;-)