About New Animationscript Event

White Dragon

New member
From last OpenBOR build:
http://www.chronocrash.com/forum/index.php?topic=3117.msg42377#msg42377
the animationscript event take  a big improvement.
Now you can use animationscript event in file or in entity.txt and between animations and @cmd SIMULTANEOUSLY!!

Example now this script works and is VALID:
Code:
name	XXX
type	player

animationscript	data/scripts/animationscript.c

anim	WALK
	@script
		void self = getlocalvar("self");
		int frame = getlocalvar("frame");

    		if ( frame > 3 ) {
			changeentityproperty(self,"animpos",0);
    		}
	@end_script

	loop	1 0 8
	offset	14 61
	bbox	7 6 18 54
	delay	10
	frame	data/chars/leo/012.gif
	sound	data/sounds/step1.wav
	frame	data/chars/leo/013.gif
	frame	data/chars/leo/014.gif
	frame	data/chars/leo/015.gif
	frame	data/chars/leo/016.gif
	sound	data/sounds/step1.wav
	frame	data/chars/leo/017.gif
	frame	data/chars/leo/018.gif
	@cmd changeentityproperty getlocalvar("self") "animpos" 0
	frame	data/chars/leo/019.gif
	frame	data/chars/leo/019.gif

		delay 10
		offset  14  48
		bbox  14  2  30  41
	frame	data/chars/leo/rise05.gif
	frame	data/chars/leo/rise05.gif

because now all animationscript will be unified into ONE!
so like in that example:

animationscript data/scripts/animationscript.c
+
@script
void self = getlocalvar("self");
int frame = getlocalvar("frame");

    if ( frame > 3 ) {
changeentityproperty(self,"animpos",0);
    }
@end_script

+
@cmd changeentityproperty getlocalvar("self") "animpos" 0

it will be unified into ONE animationscript event.

It's fantastic because now you can choose to use script between animations (@script ... @end_script or @cmd) and script into an imported file (animationscript data/scripts/animationscript.c) SIMULTANEOUSLY!!
In previous builds you were forced to choose a way...
 
Sorry, but I have removed this feature in the latest revision and do not want it added back without extensive testing. Certain modules (one example being Double Dragon Reloaded) will crash ungracefully on load.

DC
 
Damon Caskey said:
Sorry, but I have removed this feature in the latest revision and do not want it added back without extensive testing. Certain modules (one example being Double Dragon Reloaded) will crash ungracefully on load.

DC

Hi DC, rewrite the func but I can't commit.
Here the error:
Can't open file '/svn/p/openbor/engine/db/txn-current-lock': Permission denied

here new code:
OLD BUILDS:
get animationscript, get @script + @cmd -> compile last over first
NEW BUILD (I can't do a commit):
get animationscript + get @script + @cmd -> if there is an animationscript.. -> insert @script + @cmd into main() of animationscript (combine) -> unique animationscript
 
Weird. I didn't change any permission or deny you access. On my phone but will look into it soon as I'm at a desk.
 
Damon Caskey said:
Weird. I didn't change any permission or deny you access. On my phone but will look into it soon as I'm at a desk.

yes please. Tested many (like DD Reloaded) mods and all work well now!  ;)
 
It doesn't work for me still:

ded.png
 
Viper Snake said:
It doesn't work for me still:

ded.png

Sorry Viper wait for build 4313.
I can not do a commit.
That is, to upload the source.
I hope that DC will solve the problem as soon as possible.
 
I've been going through this, and it's a common SVN issue. Unfortunately there's no real working solution on Sourceforge. I ran into this once remember the only way to fix it was the following.

[list type=decimal]
[*]Copy your changes to a text or source file of your choosing outside of the OpenBOR folder. This is so you don't have to retype them
[*]Delete the conflicted source files. You might have to blow away the whole engine folder.
[*]Run an SVN update to get fresh copy of files. You should then be able to commit.
[/list]

If that doesn't work, then you'll have to completely destroy your repository and restore it from scratch. It sucks, but that's all Sourceforge will offer as a solution. :(

DC
 
Damon Caskey said:
I've been going through this, and it's a common SVN issue. Unfortunately there's no real working solution on Sourceforge. I ran into this once remember the only way to fix it was the following.

[list type=decimal]
[*]Copy your changes to a text or source file of your choosing outside of the OpenBOR folder. This is so you don't have to retype them
[*]Delete the conflicted source files. You might have to blow away the whole engine folder.
[*]Run an SVN update to get fresh copy of files. You should then be able to commit.
[/list]

If that doesn't work, then you'll have to completely destroy your repository and restore it from scratch. It sucks, but that's all Sourceforge will offer as a solution. :(

DC

tested, doesn't work =(
please see permission settings if you can.
 
I thought this worked like this before  ???

Maybe I'm missing something. WD, can you explain in more details what you can do now that you could not before ?
 
Piccolo said:
I thought this worked like this before  ???

Maybe I'm missing something. WD, can you explain in more details what you can do now that you could not before ?

It works like before and better!
Before you can't use script between animations (@script) simultaneously with animationscript data/scripts/ascript.c file.
The file c imported has the priority so you nullify all scripts between animations (@script).

With the new version you can work as you want because you can work with script between animations (@script) simultaneously with animationscript data/scripts/ascript.c file.
All animations script areunified into ONE animationscript.

Try my personal build. I can post the official build when source forge solve the current issue (no commit for now).

Invite all to test it.

DOWNLOAD:
http://www.chronocrash.com/forum/index.php?topic=3117.msg42377#msg42377
news in this build:
-reworked new animationscript
-added new script operators:
<<=
>>=
|=
&=
^=
~
 
Sorry I still don't get it  :-\

By inline script (@script) "between" animations do you mean "in" animations ?

Like in that code you wrote (the @script is "in" WALK animation) :

Code:
name	XXX
type	player

animationscript	data/scripts/animationscript.c

anim	WALK
	@script
		void self = getlocalvar("self");
		int frame = getlocalvar("frame");

    		if ( frame > 3 ) {
			changeentityproperty(self,"animpos",0);
    		}
	@end_script

	loop	1 0 8
	offset	14 61
	bbox	7 6 18 54
	delay	10
	frame	data/chars/leo/012.gif
	sound	data/sounds/step1.wav
	frame	data/chars/leo/013.gif
	frame	data/chars/leo/014.gif
	frame	data/chars/leo/015.gif
	frame	data/chars/leo/016.gif
	sound	data/sounds/step1.wav
	frame	data/chars/leo/017.gif
	frame	data/chars/leo/018.gif
	@cmd changeentityproperty getlocalvar("self") "animpos" 0
	frame	data/chars/leo/019.gif
	frame	data/chars/leo/019.gif

		delay 10
		offset  14  48
		bbox  14  2  30  41
	frame	data/chars/leo/rise05.gif
	frame	data/chars/leo/rise05.gif


If yes then, for me it's something that was valid before (and has been for years).

Maybe you mean if you put a main function in your script file, then inline scripts (@script ) in animations were not parsed before, and now they are ?

And what about the main @script (which almost no one used), the one that is not "in" animation but in header (that is the inline script that run on each frame) ?

Code:
name	XXX
type	player

animationscript	data/scripts/animationscript.c
@script
	foo();
@end_script

anim	IDLE
	@script
		void self = getlocalvar("self");
		int frame = getlocalvar("frame");

    		if ( frame > 3 ) {
			changeentityproperty(self,"animpos",0);
    		}
	@end_script

	loop	1 0 8
	offset	14 61
	bbox	7 6 18 54
	delay	10
	frame	data/chars/leo/012.gif
	...



Anyways I'll try do to some tests  :D

White Dragon said:
-added new script operators:
<<=
>>=
|=
&=
^=
~

That is nice  8)
 
I'm kind of wandering what the point of this is too. You could always combine @script and @cmd tags, from day one - even in the same animation. Moreover they were always unified into one main() as well. Exactly what is new here?

I really appreciate your enthusiasm for updates White Dragon, but I'm a little worried you are adding pet rocks that cover existing functionality.

DC
 
Damon Caskey said:
I'm kind of wandering what the point of this is too. You could always combine @script and @cmd tags, from day one - even in the same animation.

I really appreciate your enthusiasm for updates White Dragon, but I'm a little worried you are adding pet rocks that cover existing functionality.

DC

I know that you can combine @script and @cmd tags but you can not combine @script and @cmd tags with animationscript *.c file
Now you can do it.
I hope I can explain well the news...

I'm not covering existing functionality!

I make one more example, because I want you to understand the importance of this update.

See this entity.
Code:
name	XXX
type	player

animationscript	data/scripts/animationscript.c

anim	IDLE
	@script
		void self = getlocalvar("self");
		int frame = getlocalvar("frame");

    		if ( frame > 3 ) {
			changeentityproperty(self,"animpos",0);
    		}
	@end_script

	loop	1 0 8
	offset	14 61
	bbox	7 6 18 54
	delay	10
	frame	data/chars/leo/012.gif
	...

Now see this animationscript.c
Code:
#import ... ... ...
void main()
{
void self = getlocalvar("self");
 ...
 ...
 ...
}

I'm using animationscript data/scripts/animationscript.c + @script right?
Well, this is wrong (for prev builds)!! Why?? The previous builds will use JUST animationscript.c (has a priority).

In previous builds @script or @script+@cmd or @cmd as DC wrote generate an animationscript with own main().
If you use an animationscript and in that script you write a main(), the main() of animationscript generated from @script/@cmd
and main() into animationscript file will collide giving priority to animationscript main() and nullifying @script/@cmd.

With my improvement I give @script/@cmd main() + animationscript main() and unify it into ONE!!
Not just main() but whole script, but I write so to explain you simply...
I hope I was clear in explaining this time.
If you have any questions, well.. do them!

Why is this update so important?
animationscript against script/ondrawscript permit you to make lighter memory usage (if you can use animationscript obviously).
So you have more convenience to use both ways without limit. You do not have to choose what to use. you can change whenever you want or use them together (animationscripts).
 
Ok so basically it was this :

Piccolo said:
Maybe you mean if you put a main function in your script file, then inline scripts (@script ) in animations were not parsed before, and now they are ?

So to be very clear your message should have been :
White Dragon said:
I know that you can combine @script and @cmd tags but you can not combine @script and @cmd tags with animationscript MAIN FUNCTION

Because well, it was possible to combine @script and @cmd tags with animationscript, almost every existing mod does it.

This improvement has all to do with animationscript main function, and how it is handled. Not the animationscript as a whole (that is the "library" part, making functions available for inline calls in entity .txt model file).

I don't know if it's that big of deal (I trust your opinion), but yes it is an improvement !  ;)

EDIT : I'll just reiterate with this as I'm not sure you were aware it of its existence

[quote author=Piccolo]
And what about the main @script (which almost no one used), the one that is not "in" animation but in header (that is the inline script that run on each frame) ?

Code:
name	XXX
type	player

animationscript	data/scripts/animationscript.c
@script
	foo();
@end_script

anim	IDLE
	@script
		void self = getlocalvar("self");
		int frame = getlocalvar("frame");

    		if ( frame > 3 ) {
			changeentityproperty(self,"animpos",0);
    		}
	@end_script

	loop	1 0 8
	offset	14 61
	bbox	7 6 18 54
	delay	10
	frame	data/chars/leo/012.gif
	...
[/quote]

This @script tag in header is basically an equivalent to the global animationscript main function.
 
Piccolo said:
This @script tag in header is basically an equivalent to the global animationscript main function.
Yes, the script in @script generate a main() function.

Piccolo said:
This improvement has all to do with animationscript main function, and how it is handled. Not the animationscript as a whole (that is the "library" part, making functions available for inline calls in entity .txt model file).
It's perfectly well! Now all main() functions are execute: @script+@cmd main() into animationscript main().
In prev builds you cannot use both main(), but just one. Now is an all in one (AIO main()  ;D)

Piccolo said:
I don't know if it's that big of deal (I trust your opinion), but yes it is an improvement !  ;)

Big Thanks!!  ;)

Ps. In TMNT:SS I combine @script+@cmd too but I could not combine them with main() into animationscript file.
 
maxman said:
-added new script operators:
<<=
>>=
|=
&=
^=
~

What do those new script operators mean and do? Let me guess. <<= means lowest from or equal to?

that are the missing operators.
x <<= y is equal to x = x << y
<< left shift (SHL)
it shift y bytes to left.
example: 5 <<= 2;
5 to binary is 101 -> 101 << 2 -> 10100 here shift the 101 to left (addind two zeros). 10100 to decimal is 20.

for shift right (SHR):
5 >> 2 -> 101 >> 2 -> 001 (latest 01 on right is gone) so 5 >> 2 is 1.

~ is the bitwise not operator (ones' complement)
~5 = -5

usually ~ operator is useful for flags together OR (|) operator
add flag: flag |= add_flag
remove flag: flag &= ~add_flag

BTW read this page:
https://en.wikipedia.org/wiki/Bitwise_operation

OFF TOPIC Q&A
 
Back
Top Bottom