Clearing the variables

Friends, I open this discussion to answer a question about how to reset the programming made by Scripts. I had done it this way but it doesn't seem to work, so the entity returns to its normal state by resetting all scripts:

@script
void self=getlocalvar("self");
if(!frame){
clearlocalvar("self");
}
@end_script

I put "idle" and "walk" in the animations.. Openbor accepted the script fine but it is not clearing the variables...
 
Friends, I open this discussion to answer a question about how to reset the programming made by Scripts. I had done it this way but it doesn't seem to work, so the entity returns to its normal state by resetting all scripts:

@script
void self=getlocalvar("self");
if(!frame){
clearlocalvar("self");
}
@end_script

I put "idle" and "walk" in the animations.. Openbor accepted the script fine but it is not clearing the variables...

There's a lot of issues here.

First, there's no such thing as "resetting the programming made by scripts." I can only assume you want to undo some previous action or state, but you have to tell us exact;y what. There's also no such thing as "clearvariable" unless it was a user defined function. To delete a variable, assign it a NULL value:

C:
void self=getlocalvar("self");
    if(!frame){
    setlocalvar("self", NULL());
    }

...which leads to a third problem. "self" is a local variable that is predefined by the engine. There is almost never a good reason to delete it. As I said already, you need to explain in more detail what exactly you're trying to do. If language barrier is an issue, try using pictures or video. Also, please use code tags in your posts. It's very hard to read code otherwise.

DC
 
Well, I'm editing programs for Mario to jump, killing only enemies, as the Blocks are in the "obstacle" type. So I did: "changeentityproperty(self, "candamage", "TYPE_ENEMY");" ... I know I could return with: "changeentityproperty(self, "candamage", "TYPE_ENEMY", "TYPE_OBSTACLE"); but it would be returning what is contained in the basic header in "candamage" ... Do you understand?!
 
Just because an entity could damage 2 or more different entity types, doesn't mean the former always kill the latter or at least damage the latter. For example, you set candamage enemy obstacle setting be in Mario's setting. Then in obstacle's text, set something like defense all 0 which denies all taken damage. With this, Mario can stomp and kill enemies but can't destroy any obstacle by stomping.
IOW there's no need to change Mario's candamage setting just to prevent him from destroying obstacles by stomping.

The above is just a simple example. I'm fully aware that Mario has other mechanics which allows him to destroy certain obstacles but they are another story.
 
Back
Top Bottom