Help with Oscript inheritance when writing RKTEngine Subtags

Hi,

I'm pulling my hair out over this. Development env is the CS 21.1 with the latest version of the SDK. I'm trying to write WebReport subtags as Oscript to avoid having to add a complicated file transfer in my module. This should be the right way to do sub-tags based on what I've read elsewhere. I can write the tag objects no problem, but my issue has to do with inheritance. I have a series of utility functions I want to make available to my subtags. In normal oscript, you would write an object like so:

public Object MasterSubTag inherits RKTENGINE::AllTags::#'Sub-Tags'#

public function Frame GetCategoryFrame()

// My code here

return myFrame

end

end


I then write my sub tag as

public Object MySubTag inherits MasterSubTag

override function Object Execute(List args={})

Frame myFrame = .GetCategoryFrame()

end

end


Code when run ALWAYS crashes on the .GetCategoryFrame() call above. What am I missing here????

-Hugh

Comments

  • Ian_Whitfield
    edited March 24, 2021 #2

    The actual tag object isn't the execution context at runtime. If you check the __Init function for the tag it copies the Execute script to the TagProcessor object on startup using the tag name and the engine runs it as TagProcessor.TagName().

    You can use all the utils on the TagProcessor object directly from your Execute. Check out all the dataAs... utils. There is already a .dataAsCategoryFrame. Not sure if that does what you need or not. If not you will probably have to create a separate utils object in your ospace and call that from the tag. The dataAs... utils will often be optimized with caching so it's advisable to use these if there is one that does what you need.

  • Thanks Ian,

    I suspected something like that and later confirmed it, so called my util function using the long form <module>::path::to::function()

    -Hugh