Takbal 0 Posted July 3, 2009 (edited) Hi all, How to change an already defined script's path or an existing GUI class from a *mission* (not from an addon)? I am quite beginner, so probably the answer is simple. I am modifying the warfare mission and I have to change a script which is called through the onLoad definition of an existing GUI class. I un-binned the CA UI's config.bin and looked into the class definitions. Unfortunately, the script path looks like wired in by BIS using the 'ca\Warfare2\Scripts\Client\GUI\GUI_BuyGearMenu.sqf' absolute path in the 'RscDisplayBuyGear' class. #1 idea: replace the existing script or its path by some trick from the mission. I could not find a way to do this, and I doubt whether it is possible at all, so I moved on. #2 idea: as I can change which dialog class is used (in GUI_buyPrepareMenu.sqf), so lets modify the 'RscDisplayBuyGear' class to have my custom script named in the 'onLoad' part. 1. proposal for #2: inherit from the original RscDisplayBuyGear into a new RscDisplayBuyGearCustom class and use that. I tried to use the following: //////////////////// class RscDisplayBuyUnits; class RscDisplayBuyUnitsCustom : RscDisplayBuyUnits { onLoad = "[findDisplay 106, _buyType] execVM 'Scripts\Client\GUI\GUI_buyUnitsMenu.sqf'"; idd = 5088; class Filters; // are these necessary to inherit? class controlsBackground; class controls; }; ////////////////// and I replace the following line in GUI_buyPrepareMenu.sqf: ... case 'units': {CreateGearDialog [player,"RscDisplayBuyUnitsCustom"];}; ... Then when the above script is called then it complains about "Warning Message: No entry 'bin\config.bin.RscDisplayBuyUnitsCustom'." and the dialog is dead. 2. proposal for #2: try to replace the original class partially and use the original GUI_buyPrepareMenu.sqf. I have seen a a way to do this in the stra_debug2.pbo addon which works. ///////////// class RscDisplayGear; class RscDisplayBuyUnits : RscDisplayGear { onLoad = "[findDisplay 106, _buyType] execVM 'Scripts\Client\GUI\GUI_buyUnitsMenu.sqf'"; idd = 5088; class Filters { class All; class Primary; class Secondary; class HandGun; class Items; }; class controlsBackground { class Mainback; }; class controls { class CA_Filter_Arrow_Left_L; class CA_Filter_Arrow_Left_R; class CA_Filter_Left_Icont_L; class CA_Filter_Right_Icon_R; class Gear_Title; class Unit_Title; class Available_items_Text; class CA_Filter_IconUnits; class CA_Filter_Icon1Units; class CA_ItemName; class CA_Money; class CA_Money_Value; class ListboxArrows { class VScrollbar; class HScrollbar; class controls { class Available_units; class Queued_units; class CA_B_Add; }; }; class ButtonFilters; class ButtonContinue; class ButtonClose; }; }; ///////////// Result is no effect - buy menu is unmodified. stra_debug2 is an addon and uses the definition in a config.cpp, so probably I could do the same with making an addon and using its config.cpp, but I would like to have a mission without addons. I have tried to create a config.cpp in the mission folder and repeat in it what I had above, also tried converting it to config.bin, but it looks like being not used at all. 3. proposal for #2: Copy the entire class. Again, no effect. #3 idea: perhaps the problem is with the new, ArmA2-introduced CreateGearDialog command, and it cannot read classes from description.ext, only from config.bins. One of the comments say that CreateGearDialog is used because of filtering; not sure whether using CreateDialog helps. Anyway, replaced it with CreateDialog and tried the proposals above again. Now the problem is that the class definition cannot see the base classes. Tried to look around the files, but no .hpp's to include. I tried renaming CAUI's config.cpp into UI.hpp and including this in description.ext, it partially works, but throws a lot of error. So then 1. how to use CreateGearDialog with a custom-made mission class? 2. if it is impossible, then how to make description.ext aware of the classes defined in the UI's config.bin, and use them properly with CreateDialog? Any ideas welcome... ------------------------------------------------------ UPDATE: If I create an addon with the following config.cpp: /////// class CfgPatches { class RscDisplayBuyUnitsCustom { units[] = {}; weapons[] = {}; requiredVersion = 0.100000; requiredAddons[] = {}; }; }; class RscDisplayBuyUnits; class RscDisplayBuyUnitsCustom : RscDisplayBuyUnits { onLoad = "[findDisplay 106, _buyType] execVM 'Scripts\Client\GUI\GUI_buyUnitsMenu.sqf'"; idd = 5088; }; //////// it works. But come on - it is such a mess to force people to download and install a 450 BYTE (!!!) .pbo. There should be another way... Edited July 3, 2009 by Takbal Share this post Link to post Share on other sites
[asa]oden 0 Posted July 17, 2009 Nice effort Takbal. I too would like to add a humble vote for a "class RscDisplayBuyUnitsCustom" in the upcoming 1.03 patch. My current Warfare is running on my addon so the config is no issue atm. but if and when I'd like to make it addon less for a broader public this current hardcoded call will be a nogo. /theOden Share this post Link to post Share on other sites