Solved storeXvel & retrieveXvel() scripts

Question that is answered or resolved.

Bruce

Active member
Hello everyone,

Can someone please help me understand these scripts?
They were used in the go_bys, but I don't understand what they are or how they work.
storeXvel function was used in the jump animation.
Thank you very much.

Code:
void storeXvel() {
    void self = getlocalvar("self");
    int side = (getentityproperty(self, "direction")== 0) ? (-1) : (1);

    setlocalvar("xVel" + self, getentityproperty(self,"xdir")*side);
}

/*
 * retrieves X velocity in a local var,
 * stored by storeXvel()
 * created by Don Drago
 */
float retrieveXvel() {
    void self = getlocalvar("self");
    return getlocalvar("xVel" + self);
}
 
Solution
Hello everyone,

Can someone please help me understand these scripts?
They were used in the go_bys, but I don't understand what they are or how they work.
storeXvel function was used in the jump animation.
Thank you very much.

Code:
void storeXvel() {
    void self = getlocalvar("self");
    int side = (getentityproperty(self, "direction")== 0) ? (-1) : (1);

    setlocalvar("xVel" + self, getentityproperty(self,"xdir")*side);
}

/*
 * retrieves X velocity in a local var,
 * stored by storeXvel()
 * created by Don Drago
 */
float retrieveXvel() {
    void self = getlocalvar("self");
    return getlocalvar("xVel" + self);
}

They are quite self explanatory - it's right in the names. The functions are storing an entity's current...
Hello everyone,

Can someone please help me understand these scripts?
They were used in the go_bys, but I don't understand what they are or how they work.
storeXvel function was used in the jump animation.
Thank you very much.

Code:
void storeXvel() {
    void self = getlocalvar("self");
    int side = (getentityproperty(self, "direction")== 0) ? (-1) : (1);

    setlocalvar("xVel" + self, getentityproperty(self,"xdir")*side);
}

/*
 * retrieves X velocity in a local var,
 * stored by storeXvel()
 * created by Don Drago
 */
float retrieveXvel() {
    void self = getlocalvar("self");
    return getlocalvar("xVel" + self);
}

They are quite self explanatory - it's right in the names. The functions are storing an entity's current X velocity into a local variable and then retrieving it respectively (presumably to apply back to the entity after something else changed it).

DC
 
Solution
They are quite self explanatory - it's right in the names. The functions are storing an entity's current X velocity into a local variable and then retrieving it respectively (presumably to apply back to the entity after something else changed it).

DC
I understood by looking at the names, but I just can't figure out in which situations that they would be used for. Especially, in the jump animation: why would storeXvel() be in the jump animation?
Thank you
 
I understood by looking at the names, but I just can't figure out in which situations that they would be used for. Especially, in the jump animation: why would storeXvel() be in the jump animation?
Thank you

It just depends. Maybe it's a move that stops in mid air and the creator wanted to start it up again. OpenBOR also auto halts velocity and they might be trying to override that. There's no way to know for certain though without having the whole game and even then we might be wrong about what the creator was trying to do.

I can tell you what a singular function does, but you can't expect to just post some random stuff and have us guess what a creator meant to do with it.

DC
 
It just depends. Maybe it's a move that stops in mid air and the creator wanted to start it up again. OpenBOR also auto halts velocity and they might be trying to override that. There's no way to know for certain though without having the whole game and even then we might be wrong about what the creator was trying to do.

I can tell you what a singular function does, but you can't expect to just post some random stuff and have us guess what a creator meant to do with it.

DC
My apology.
Basically, I can always speed it up or slow it down, or even make it stop then resume it to the previous speed that was saved.
With your 2nd explanation, I now understand it better.
thank you very much.
 
My apology.
Basically, I can always speed it up or slow it down, or even make it stop then resume it to the previous speed that was saved.
With your 2nd explanation, I now understand it better.
thank you very much.

No apologies needed. I just wanted you to understand the limits of what we can guess from seeing functions.

DC
 
Back
Top Bottom