Jump to content
Sign in to follow this  
firefly2442

Tool - ArmaScriptTrace

Recommended Posts

ArmaScriptTrace

Example Screenshot

http://img709.imageshack.us/img709/8944/testqk.png

Hello,

I wrote a small Java application that is able to parse Arma script files and trace the execution calls of other scripts via #includes, execvm, etc. It then displays a nice tree graph image using GraphViz showing the structure. Anyway, I find it handy when making missions to run it on init.sqf and see what scripts are being called.

Please test and let me know if it breaks or is unable to parse something. Or, if you have suggestions I would love to hear them.

Thanks.

Current Version:

v0.4 (BETA) - still some bugs I think, please test :)

Dev-Heaven Project Page:

http://dev-heaven.net/projects/arma-script-trace

Download:

http://dev-heaven.net/projects/arma-script-trace/files

Requirements:

Java Runtime Environment

Edited by firefly2442
new release

Share this post


Link to post
Share on other sites

Hmm I may be doing it wrong or perhaps (unlikely) I need to update my JRE or something. It usually pops up whenever it needs updating though. I've tried on my carrier addon and on a mission I made but neither return any image, and trying to save just saves an empty file. Any other system requirements? 32/64-bit issues perhaps? Regardless this seems kinda neat, especially for larger projects, to visually see it.

Share this post


Link to post
Share on other sites

Hmm, so you've tried going to Open, and then specifying like your init.sqf file or something? Have you tried it on any other files or missions? I don't believe there are 32/64 compatibility issues, however, it may be possible I missed a dependency for GraphViz.

Try this, open up your file again and minimize the app (don't close it). Go into the folder and check to see if there is a "temp.dot" and/or "temp.png" file. That will tell us if it's actually running.

Thanks for testing.

Share this post


Link to post
Share on other sites

Just tried it myself, I open a file and nothing. It creates a temp.dot with just some armtrace text but nothing else.

If I try and save temp.png it saves nothing.

Share this post


Link to post
Share on other sites
Just tried it myself, I open a file and nothing. It creates a temp.dot with just some armtrace text but nothing else.

If I try and save temp.png it saves nothing.

Same here. Windows 7 Enterprise 64Bit - Java 6 Update 21

Share this post


Link to post
Share on other sites

What version of Java are both of you running? When I ran it on my development machine I had 1.6. If you open up the console and type "java -version" it will tell you.

edit: Hmm, ok clearly I goofed on something. Thanks for trying. I'll see if I can fix it this evening.

Share this post


Link to post
Share on other sites

I just tried it on another machine and it seems to work fine. At this point, I'm guessing it's hanging when it parses the file. For those of you where it doesn't work, can you please post/send me the file/files that you tried running it on. If you want, you can PM me or send me an email. My email is "my_forum_username@hotmail.com". (Take that spam bots!). ;)

Thanks in advance.

Share this post


Link to post
Share on other sites

removed old download link.

Thanks, try this updated zip.

Edited by firefly2442
old link

Share this post


Link to post
Share on other sites

Ok were getting a little further.

Now when I open a file I get the following

myfile.Utes Created by AramScriptTrace Version:0.11 script.sqf

I'm not really sure how that helps

Share this post


Link to post
Share on other sites

If your script isn't calling other scripts via #include, execvm, or preprocessline methods, then you probably don't need this tool. For large missions or mods that have lots of scripts this is more helpful. Make sure whatever script you are running it on is the highest one (like init.sqf or something).

---------- Post added at 03:31 AM ---------- Previous post was at 01:50 AM ----------

I've got a bunch of stuff planned for the next release that will parse more files and help modders. .hpp, .fsm, and .sqm files are on the TODO list. ;) Stay tuned.

Share this post


Link to post
Share on other sites

That could be it, I did try a load but I do tend to avoid the larger codes for exactly that reason as it gets hard to follow.

This should help with that thanks..

Share this post


Link to post
Share on other sites

Nice !

Usefull to understand how BI modules are made !

[edit]

Little probleme:

doesn't work with BI arty module:

I open init.sqf wich contains an include of a file and call some functions:

#include "h\arty_scripts.hpp"

...

[] call __arty_fmTemplates;

...

function's names are defined in arty_script.hpp, example:

#define __arty_callSplash compile preprocessFileLineNumbers (__bis_arty_path + "scripts\ARTY_callSplash.sqf")

#define __arty_firingSolution compile preprocessFileLineNumbers (__bis_arty_path + "scripts\ARTY_firingSolution.sqf")

#define __arty_Comms compile preprocessFileLineNumbers (__bis_arty_path + "scripts\ARTY_Comms.sqf")

Edited by Le_CuLtO

Share this post


Link to post
Share on other sites

Hm, it's not working for me. I used it on my init.sqf and here's the result:

unbenanntcs3t.jpg

init.sqf

// Teamswitch
enableTeamswitch true;

/* Friend and Foe - DOES NOT WORK!
WEST setFriend [EAST,1];   
EAST setFriend [WEST,1];*/

{_x setCaptive true} forEach allUnits;

// Marker
{_x setMarkerAlpha 0} forEach ["UPSMON_marker_1", "sparky_marker", "car_depot_marker"];

// Initialization
waitUntil {!(isNil "BIS_MPF_initDone") AND !(isNil "BIS_fnc_init") AND !(isNull player)};
waitUntil {BIS_fnc_init};
// Initialization

// For Testing Purposes Only!!!
teleport = player addAction ["Teleport","scripts\teleport.sqf"];
{_x allowDamage false} forEach units group player;
// For Testing Purposes Only!!!

if (isServer) then {
   // Mission's Main Scope - Store for Mission Variables
   _missionScopeGroup = createGroup sideLogic; 
   "Logic" createUnit [[10, 10, 0], _missionScopeGroup, "BIS_missionScope = this"];
   publicVariable "BIS_missionScope";

   // Main Variables
   {BIS_missionScope setVariable _x} forEach [["IP_Convoy_Attacked", false], ["IP_Convoy_Defended", false], ["IP_Ambient_Artillery", false], ["IP_LZ_Reached", false], ["IP_VIP_Safe", false], ["IP_Extracted", false] ];

   // Briefing
   _nic = [objNull, player, "per", rCREATEDIARYRECORD, "Credits", "Mission Editing and Scripting by IndeedPete!<br/><br/>Thanks to:<br/>norrin for his great 'Convoy Control Script'!<br/>BIS for this awesome game wich i love and sometimes really hate! :)"] call RE;
   _nic = [objNull, player, "per", rCREATEDIARYRECORD, "Diary Entry", "1Lt. Lionel Spheres - 1st SFOD-D (A)<br/><br/>Great, another day in Takistan. Seven days from now on and i'll finally leave this damn country! I've spend two fucking years here; have been there from the beginning. I still remember the invasion as if it happened just yesterday. Dead soldiers, crippled wounded, explosions, killed civillians... To see Takistan now makes me wonder if the occupation made sense in the first place. The population seems friendly but they'll stab you the moment you turn around to resume your patrol. Media says that Takistan is friendly and peacefully now. The say it's a good place for tourism. But i see dead comrades every day, new wounded every day. I know what goes on in the villages outside the cities where no-one patrols except us Delta members hunting remainig terrorist leaders. But command wouldn't listen. They don't want to hear it and prefer to stay in their dream world where the invasion was a success. Anyway, this is my last week here. Only this last job and i can return back home and leave it all behind..."] call RE;
   _nic = [objNull, player, "per", rCREATEDIARYRECORD, "Support", "1 HMMWV (MK19) - 'Bodyguard One'<br/>1 HMMWV SOV - 'Bodyguard Two'<br/>1 SUV - 'Bodyguard Three'<br/>1 HMMWV - 'Bodyguard Four'<br/>1 Stryker ICV (M2) - 'Bodyguard Five'<br/>1 A10 - 'Guardian Angel'<br/>12 US army regulars<br/>4 Delta Force members<br/>4 Secret Service members<br/>Additional US army regulars at the checkpoints"] call RE;
   _nic = [objNull, player, "per", rCREATEDIARYRECORD, "Execution", "The convoy will start at <marker name=""residence"">President Hamir's Residence</marker> and passes on his way the checkpoints <marker name=""c_pos_5"">'Victor'</marker>, <marker name=""c_pos_10"">'Romeo'</marker>, <marker name=""c_pos_14"">'Charlie'</marker>, <marker name=""c_pos_16"">'Juleen'</marker> and <marker name=""c_pos_22"">'Barney'</marker> before it finally reaches the <marker name=""airport"">Airport of Zargabad</marker>. The convoy has to report back at 'Overlord' at every checkpoint."] call RE;
   _nic = [objNull, player, "per", rCREATEDIARYRECORD, "Mission", "The task is to get VIP One safe and without any interruptions from <marker name=""residence"">President Hamir's Residence</marker> to the <marker name=""airport"">Airport of Zargabad</marker>. Therefor, a convoy of 5 vehicles (callsigns: 'Bodyguard One' to 'Bodyguard Five') has been established. 'Guardian Angel' will secure the airspace and provide surveillance. Command element 'Overlord' will overwatch the mission and provides tactical advisory as well as satellite surveillance. Protect VIP One at all costs!"] call RE;
   _nic = [objNull, player, "per", rCREATEDIARYRECORD, "Situation", "Takistan is now fully under UN control. 80% of the US forces in Takistan have already left the country. The remaining 20% are concentrated at several FOBs around the state. Takistani army regulars are slowly replacing the UN troops in law enforcement and military assignments. Rebuilding is mostly completed but there are still destroyed houses and villages. The civilian population is friendly to members of the UN. This mission will take place inside the <marker name=""green_zone"">'Green Zone of Zargabad'</marker>, a well protected, peacefully part of Zargabad. US army regulars have established checkpoints alongside the convoy route. The checkpoints are: <marker name=""c_pos_5"">'Victor'</marker>, <marker name=""c_pos_10"">'Romeo'</marker>, <marker name=""c_pos_14"">'Charlie'</marker>, <marker name=""c_pos_16"">'Juleen'</marker> and <marker name=""c_pos_22"">'Barney'</marker>."] call RE;
   _nic = [objNull, player, "per", rCREATEDIARYRECORD, "Briefing", "U.S. President Ronald Taylor (after this called 'VIP One') visited the takistani President Mahmut Hamir to negotiate the future of Takistan. After the talk, VIP One will be transported from <marker name=""residence"">President Hamir's Residence</marker> to the <marker name=""airport"">Airport of Zargabad</marker> by car to speak to our remaining troops. The convoy will be protected by 'Bodyguard One' to Five and 'Guardian Angel' as well as 'Overlord' as command element wich provides tactical advisory and surveillance."] call RE;

   // Tasks
   _nic = [objNull, player, "per", rCREATETASKSET, "taskConvoy", ["Move VIP One from <marker name=""residence"">President Hamir's Residence</marker> to the <marker name=""airport"">Airport of Zargabad</marker>!", "Reach Zargabad Airport", "Zargabad Airport"], markerPos "airport"] call RE;
   _nic = [objNull, player, "per", rCREATETASKSET, "taskVIP", ["Protect VIP One at all costs!", "Protect VIP One",""]] call RE;

   // Mission FSM
   execFSM "mission.fsm";

   // ACM Control
   [] spawn {
       // Initialization
       waitUntil {!isNil {IP_ACM getVariable "initDone"}};
       waitUntil {IP_ACM getVariable "initDone"};
       // Initialization

       [0, IP_ACM] call BIS_ACM_setIntensityFunc;
       [iP_ACM, 50, 500] call BIS_ACM_setSpawnDistanceFunc;
       [["BIS_US", "BIS_CZ", "BIS_GER", "BIS_TK", "BIS_TK_INS", "BIS_UN"], IP_ACM] call BIS_ACM_setFactionsFunc;
   };

   // Init UPSMON script
   call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf";

   // First Scene
   execVM "scenes\start.sqf";
};

waitUntil {time > 0};
// Info Text
["01 Weal And Woe", str(date select 2) + "." + str(date select 1) + "." + str(date select 0), "President Hamir's Residence"] spawn BIS_fnc_infoText;
sleep 10;
["Taskforce Knight", "1Lt. Lionel Spheres", "1st SFOD-D (A)"] spawn BIS_fnc_infoText;

scenes\start.sqf

// Add Topics
[objNull, spheres, "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE;
[objNull, taylor_double, "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE;
[objNull, overlord, "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE;
[objNull, (gunner c_hmmwv_1), "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE; // Bodyguard One
[objNull, c_hmmwv_2_gunner, "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE; // Bodygaurd Two
[objNull, c_bodyguard_1, "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE; // Bodygaurd Three
[objNull, (driver c_hmmwv_3), "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE; // Bodygaurd Four
[objNull, (commander c_stryker), "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE; // Bodygaurd Five
[objNull, guardian_angel, "per", rKBADDTOPIC, "start", "scenes\start.bikb", ""] call RE;

sleep 3;

// First Conversation
[objNull, overlord, rKBTELL, player, "start", "overlord_1"] call RE;
sleep 4;
[objNull, (gunner c_hmmwv_1), rKBTELL, overlord, "start", "bodyguard_one_1"] call RE;
sleep 4;
[objNull, spheres, rKBTELL, overlord, "start", "bodyguard_two_1"] call RE;
sleep 4;
[objNull, c_bodyguard_1, rKBTELL, overlord, "start", "bodyguard_three_1"] call RE;
sleep 4;
[objNull, (driver c_hmmwv_3), rKBTELL, overlord, "start", "bodyguard_four_1"] call RE;
sleep 4;
[objNull, (commander c_stryker), rKBTELL, overlord, "start", "bodyguard_five_1"] call RE;
sleep 3;
[objNull, guardian_angel, rKBTELL, overlord, "start", "guardian_angel_1"] call RE;
sleep 4;
[objNull, overlord, rKBTELL, player, "start", "overlord_2"] call RE;
sleep 8;
[objNull, (gunner c_hmmwv_1), rKBTELL, overlord, "start", "bodyguard_one_2"] call RE;
sleep 8;

SAVEGAME;

// Convoy Control Script - Convoy starts to move
[["c_pos_5", "c_pos_10", "c_pos_14"], [c_hmmwv_1, c_hmmwv_2, c_suv, c_hmmwv_3, c_stryker]] execVM "scripts\convoyDefend_init.sqf";

// Conversations along the way - Checkpoint Victor
waitUntil {(c_hmmwv_1 distance (getMarkerPos "c_pos_5")) <= 10};
[objNull, (gunner c_hmmwv_1), rKBTELL, overlord, "start", "bodyguard_one_3"] call RE;
sleep 7;
[objNull, overlord, rKBTELL, player, "start", "overlord_3"] call RE;
sleep 10;
[objNull, overlord, rKBTELL, player, "start", "overlord_4"] call RE;
sleep 8;
[objNull, guardian_angel, rKBTELL, overlord, "start", "guardian_angel_2"] call RE;
sleep 7;
[objNull, overlord, rKBTELL, player, "start", "overlord_5"] call RE;
sleep 5;

// Checkpoint Romeo
[objNull, (gunner c_hmmwv_1), rKBTELL, overlord, "start", "bodyguard_one_4"] call RE;
sleep 5;
[objNull, overlord, rKBTELL, player, "start", "overlord_6"] call RE;
sleep 4;

// Checkpoint Charlie - Before Ambush
waitUntil {(c_hmmwv_1 distance (getMarkerPos "c_pos_14")) <= 50};
[objNull, (gunner c_hmmwv_1), rKBTELL, overlord, "start", "bodyguard_one_5"] call RE;
sleep 8;
[objNull, overlord, rKBTELL, player, "start", "overlord_7"] call RE;
sleep 9;
[objNull, (gunner c_hmmwv_1), rKBTELL, overlord, "start", "bodyguard_one_6"] call RE;
sleep 4;

// Explosion - Death!
"Bo_GBU12_LGB" createVehicle (position c_attack_truck);
{_x setDamage 1} forEach [c_hmmwv_1, (gunner c_hmmwv_1), (driver c_hmmwv_1), c_hmmwv_2_driver, c_hmmwv_2_turret, c_bodyguard_1, c_bodyguard_2];
BIS_missionScope setVariable ["IP_Convoy_Attacked", true];
sleep 2;
c_hmmwv_2 lock false;
{_x action ["EJECT", c_hmmwv_1]; unassignvehicle _x} forEach [spheres, d2, d3, d4];
sleep 1;
c_hmmwv_2 lock true;

// Ambush
[objNull, spheres, rKBTELL, player, "start", "spheres_1"] call RE;
sleep 3;
[objNull, overlord, rKBTELL, player, "start", "overlord_8"] call RE;
sleep 5;
[objNull, spheres, rKBTELL, overlord, "start", "spheres_2"] call RE;
sleep 8;
[objNull, overlord, rKBTELL, player, "start", "overlord_9"] call RE;
sleep 8;

if (alive c_attack_bmp) then {c_attack_bmp setDamage 1};

SAVEGAME;

sleep 120 + (random 120);

if (alive c_stryker) then {c_stryker setDamage 1};

BIS_missionScope setVariable ["IP_Convoy_Defended", true];

// Convoy Defended 
[objNull, overlord, rKBTELL, player, "start", "overlord_10"] call RE;
sleep 9;
[objNull, overlord, rKBTELL, player, "start", "overlord_11"] call RE;
sleep 6;
[objNull, overlord, rKBTELL, player, "start", "overlord_12"] call RE;
sleep 10;
[objNull, overlord, rKBTELL, player, "start", "overlord_13"] call RE;
sleep 6;
[objNull, spheres, rKBTELL, overlord, "start", "spheres_3"] call RE;
sleep 5;
[objNull, spheres, rKBTELL, taylor_double, "start", "spheres_4"] call RE;
sleep 6;
[objNull, taylor_double, rKBTELL, player, "start", "taylor_1"] call RE;
sleep 5;

deletevehicle taylor_double;
[taylor] join (group spheres);
taylor setPos (position spheres);

SAVEGAME;

It recognizes a variable as file?^^ Great idea though, keep on working! :)

Share this post


Link to post
Share on other sites

@IndeedPete - I just tried it with the latest version that I'm working on 0.25 and it works. I would release it so you guys can test but there's one small bug in the GUI that I'm still working on. It's tricky, but there are MANY improvements. :)

@Le_CuLtO - So the problem is these variables are included in the path so it cannot parse these?

Share this post


Link to post
Share on other sites

[old download link removed]

Updated version. The bug is still there but technically the program works correctly. The scrollbars may just be wrong if you load multiple mods/missions. If anyone has any ideas how to fix this I would really appreciate it.

Cheers.

Edited by firefly2442

Share this post


Link to post
Share on other sites

See, if you would have made this little app a couple years ago ... befere I spent countless hours digging thru the guru's missions and things ... :p

Works well, hope we can extend it some more for the mod thingies ;)

Share this post


Link to post
Share on other sites

Looks like a very helpful tool at first glance, thanks.

It would be even better if the bubbles and connections could be rearranged and zoom in and out would be nice too.

Share this post


Link to post
Share on other sites

I think I could add zooming. Rearranging is not possible in the way it's setup because Graphviz creates an image and then this static image is displayed. It is possible to play with different display configurations though. I can look into it. Also, with some help from a friend I was able to get that display bug fixed. I'll add some more features and release a new version this week hopefully. :)

Share this post


Link to post
Share on other sites

Version 0.4 BETA released. New features are:

* scrollPane resizes after loading multiple files (this was fixed by creating multiple image files)

* Add ability to set tree or cluster mode for the resulting graphics file

* Add ability to drag and drop files onto the main window to load scripts

* Add ability to save images to PNG, JPG, and PDF

* Default save location to Desktop

* Add ability to filter by filetype

* Add ability to filter by method calls

* Fixed some bugs, restructured the dot generator a little

* Open menu item disabled while processing script

* Delete image and dot files on run just in case there are leftovers from previous run

* Check file size of resulting image to see if GraphViz worked correctly, if not display error message

Sorry for the long wait, but there are quite a lot of new features in this one. Please test, thanks. :)

Share this post


Link to post
Share on other sites

firefly2442, could you make ArmaScriptTrace work with Ofp missions and scripts too?

I think you only would have to add "exec" and "call" to your regular expressions in the file search since those key words are not listed in your readme, right?

Share this post


Link to post
Share on other sites
firefly2442, could you make ArmaScriptTrace work with Ofp missions and scripts too?

I think you only would have to add "exec" and "call" to your regular expressions in the file search since those key words are not listed in your readme, right?

Yes, actually, even better than that I want to add a text box to the top that will allow you to put in your own custom regular expressions. Then it will truly work for anything. Been really busy with "real-life" stuff lately but it's on the todo list. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×