Wikia

Vault-Tec Labs

How to decompile a script

400pages on
this wiki
Talk1

A small tutorial by [Modmaker], which explains how to clean-up a decompiled script, to make it usable again. I used as example iipit.int script.

Open FSE, decompile the script.

Now you've got something like this:

 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 compilable script. Only errors, errors and again errors.


Delete this:

 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;[/code]

Also delete procedure checkPartyMembersNearDoor.

 procedure checkPartyMembersNearDoor
 begin
      // ............ looooong procedure
 end 

Ok now it is much better  :wink:

Go to Edit --> Find and replace.

 Find:          _op
 Replace      (this leave empty)[/code]
 Click "replace all".

Do the same...

 Find:          ()
 Replace      (this leave empty)

Now it is a compilable 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.

Around Wikia's network

Random Wiki