Skip to content

ClearObjectVisualTransformation Question

nwfan87nwfan87 Member Posts: 99
edited June 2023 in Builders - Scripting
Very quick one. What is the best way to delay ClearObjectVisualTransformation, on the assumption that SetObjectVisualTransformation has already been executed? It seems it will not take a DelayCommand prompt.

Thank you!

Comments

  • ProlericProleric Member Posts: 1,290
    The function name is ClearObjectVisualTransform().

    It should work with DelayCommand.

    If for some reason it doesn't, try putting it in a function, then delay execution of the function.
  • nwfan87nwfan87 Member Posts: 99
    @Proleric That's what I've been trying thus far, but I get the ERROR: DECLARATION DOES NOT MATCH PARAMETERS message.
    Here's the line, which I think follows the info on Lexicon

    DelayCommand(4.0, ClearObjectVisualTransform(oCreature, -1));
  • meaglynmeaglyn Member Posts: 150
    edited June 2023
    Right, so the Lexicon is wrong there:
    int ClearObjectVisualTransform(object oObject, int nScope = -1);

    The function returns an int. So it can't be used directly in DelayCommand(). You need to wrap it in a little void function (which is what @Proleric suggested in his last line there...).
  • nwfan87nwfan87 Member Posts: 99
    edited June 2023
    @meaglyn No Idea how to do that ("Should I be writing scripts I ask myself"). You mean to define the int such as

    int iNumber = ??? (some sort of function to grab the visual transformation?), not sure on what it means when it asks for nScope, but then how to put that into a DelayCommand? :D

    Do you mean something like

    DelayCommand(3.0, ClearObjectVisualTransformation(oCreature, OBJECT_VISUAL_TRANSFORATION...));
  • ProlericProleric Member Posts: 1,290
    From memory, something like this before the options (main) line:
    void zIntWrapper(int i) return;
    

    Then
    DelayCommand(3.0, zIntWrapper(ClearObjectVisualTransformation(oCreature, OBJECT_VISUAL_TRANSFORATION...)));
    

    The function does nothing except trick the compiler into accepting the void argument it's expecting.
  • nwfan87nwfan87 Member Posts: 99
    @Proleric Would have never have guessed that without asking. Thank you! Can
    void zIntWrapper(int i) return;
    
    Be nested into the script, or it has to be top level? If it had to be nested, it would be possible to simply call
    ExecuteScript "the_script"
    
    in the nest, and just make a separate file to allow
    void zIntWrapper(int i) return;
    
    ?
  • ProlericProleric Member Posts: 1,290
    See Lexicon for examples of how to declare a function.

    You can also delay a script that executes the entire ClearObjectVisualTransform command, but that's an unnecessary complication in this simple case.
  • nwfan87nwfan87 Member Posts: 99
    Thank you @Proleric. I tried the following:
    int zIntWrapper(int i)
    {
        // ...
        return -1;
    }
    void main ()
    {
    //...
    //... SCRIPT STUFF
    
    DelayCommand(3.0, zIntWrapper(ClearObjectVisualTransform(oCreature, OBJECT_VISUAL_TRANSFORM_SCALE)));
    
    

    Couldn't get your version to compile, so used a structure similar to the Lexicon, but no luck there either. I'm trying some other method now, hoping that I'll come up with something that is in my capabilities as an average joe script sticker together-er. But I'll persist on trying who knows, I might strike the nail one day!
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    Something like this might work:
    void zIntWrapper(int i)
    {
        return;
    }
    
    void main()
    {
        object oCreature = GetLastUsedBy();//or whatever
        //script stuff
        //script stuff
        DelayCommand(3.0, zIntWrapper(ClearObjectVisualTransform(oCreature, -1)));
    }
    

    One reason you might have run into problems with ClearObjectVisualTransform is that it's asking specifically for one of the "OBJECT_VISUAL_TRANSFORM_DATA_SCOPE_........" for the second parameter.
  • MelkiorMelkior Member Posts: 187
    nwfan87 wrote: »
    Thank you @Proleric. I tried the following:
    int zIntWrapper(int i)
    {
        // ...
        return -1;
    }
    void main ()
    {
    //...
    //... SCRIPT STUFF
    
    DelayCommand(3.0, zIntWrapper(ClearObjectVisualTransform(oCreature, OBJECT_VISUAL_TRANSFORM_SCALE)));
    
    

    Couldn't get your version to compile, so used a structure similar to the Lexicon, but no luck there either. I'm trying some other method now, hoping that I'll come up with something that is in my capabilities as an average joe script sticker together-er. But I'll persist on trying who knows, I might strike the nail one day!

    The reason you couldn't get it to work is right there in the first line of your code. The function must return a VOID type, not an INT type, which means that the return must be empty. Just "return;" and nothing else.
  • nwfan87nwfan87 Member Posts: 99
    @Melkior @NeverwinterWights Thank you for this, It was a great moment when the script finally did what I was expecting! I'll be making sure to give you @Proleric, @meaglyn and anyone else who contributed on this thread, credit. Thank you so much for your patience everyone, in dealing with my Level 1 scripting knowledge. Positive this will come in handy again. :) Thank you all again!
Sign In or Register to comment.