Update Inline Scripts to Online Code

dantedevil

Well-known member
I'm trying to optimize several scripts, to use them in a more efficient way, like Inline code. :)
I decided to open this thread, while I'm trying on my own and when I can't do it, I'll share the scripts and request the necessary help.

In this particular case, I want to create a script similar to the one I share, but instead of "current_branch", I'll use "current_set". 👈

So the new script would be @cmd setAni

Code:
void branchAni(void branch, void Ani)
{// Branch Checker and Animation changer
// Dantedevil

    void self = getlocalvar("self");
    char branchC = openborvariant("current_branch");

    if(branch==branchC){
      changeentityproperty(self, "animation", openborconstant(Ani), 2); //Change the animation
    }
}

My problem here, is that I did not find information about what I should put instead of "char branchC". :unsure:
 
Last edited:
@dantedevil, I'm not sure about the branching because I don't know exactly what you mean. I do see a serious issue though. I think you missed the part about never concatenating strings into openborconstant().

This part of your code:

Rich (BB code):
changeentityproperty(self, "animation", openborconstant(Ani), 2); //Change the animation

Never, EVER, do that. It's a huge performance hog.

Do this:

C:
void branchAni(void branch, int animation_id)
{// Branch Checker and Animation changer
// Dantedevil

    void self = getlocalvar("self");
    char branchC = openborvariant("current_branch");

    if(branch==branchC){
      changeentityproperty(self, "animation", animation_id, 2); //Change the animation
    }
}

Then when you call your function, send it the constant, like this example:

Code:
@cmd branchAni 1 openborcosntant("ANI_ATTACK")

I detailed all of this in my tutorial.

DC
 
This script worked fine so far...
C++:
void branchAni(void branch, void Ani)
{// Branch Checker and Animation changer
// Dantedevil

    void self = getlocalvar("self");
    char branchC = openborvariant("current_branch");

    if(branch==branchC){
      changeentityproperty(self, "animation", openborconstant(Ani), 2); //Change the animation

What I want to do is create something similar, but that identifies the set and changes the animation if it matches.


ich (BB code):

changeentityproperty(self, "animation", openborconstant(Ani), 2); //Change the animation


Never, EVER, do that. It's a huge performance hog.
I did not know that... 😬
I have always used the scripts, the way they were given to me, there are very few that I have modified, but always keeping the original lines. :confused:

So the best thing to do would be to update that line of all the scripts that have it, the one you just gave me, to better optimize its operation. :unsure:


Well @DCurrent , i try in both ways for the new sript:

This not work:
C++:
void setAni(void set,  int animation_id)

{// Set Checker and Animation changer
// Dantedevil

    void self = getlocalvar("self");

    char setC = openborvariant("current_set");


    if(set==setC){

      changeentityproperty(self, "animation", animation_id, 2); //Change the animation

    }

}

And call function:
C++:
        @cmd    setAni 0 "ANI_FALL28"

It does not cause any errors. just nothing happens.

This works perfect:
C++:
void setAni(void set, void Ani)
{// Set Checker and Animation changer
// Dantedevil

    void self = getlocalvar("self");
    char setC = openborvariant("current_set");

    if(set==setC){
      changeentityproperty(self, "animation", openborconstant(Ani), 2); //Change the animation
    }
}

And the same call function:
C++:
        @cmd    setAni 0 "ANI_FALL28"

🤨
 
Last edited:
This script worked fine so far...
C++:
void branchAni(void branch, void Ani)
{// Branch Checker and Animation changer
// Dantedevil

    void self = getlocalvar("self");
    char branchC = openborvariant("current_branch");

    if(branch==branchC){
      changeentityproperty(self, "animation", openborconstant(Ani), 2); //Change the animation

What I want to do is create something similar, but that identifies the set and changes the animation if it matches.



I did not know that... 😬
I have always used the scripts, the way they were given to me, there are very few that I have modified, but always keeping the original lines. :confused:

So the best thing to do would be to update that line of all the scripts that have it, the one you just gave me, to better optimize its operation. :unsure:


Well @DCurrent , i try in both ways for the new sript:

This not work:
C++:
void setAni(void set,  int animation_id)

{// Set Checker and Animation changer
// Dantedevil

    void self = getlocalvar("self");

    char setC = openborvariant("current_set");


    if(set==setC){

      changeentityproperty(self, "animation", animation_id, 2); //Change the animation

    }

}

And call function:
C++:
        @cmd    setAni 0 "ANI_FALL28"

It does not cause any errors. just nothing happens.

This works perfect:
C++:
void setAni(void set, void Ani)
{// Set Checker and Animation changer
// Dantedevil

    void self = getlocalvar("self");
    char setC = openborvariant("current_set");

    if(set==setC){
      changeentityproperty(self, "animation", openborconstant(Ani), 2); //Change the animation
    }
}

And the same call function:
C++:
        @cmd    setAni 0 "ANI_FALL28"

🤨

You completely ignored my example. Please see again how you call the function after it's fixed:

Rich (BB code):
@cmd branchAni 1 openborcosntant("ANI_FALL28")

HTH,
DC
 
Back
Top Bottom