Scripting newbie

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

Post Reply
User avatar
FunkyD
Posts: 6
Joined: Sat Jun 19, 2004 7:14 pm

Scripting newbie

Post by FunkyD »

I have a collection of sprites in the following directory:
/G-Force/Sprites/(Non-Auto)/SongX

The files are named 00SongX.jpg, 01SongX.jpg... all the way up to 20SongX.jpg

Now, suppose I wanted to create a script like "CTRL X.txt" that would randomly display all those sprites in that directory.

It seems like "rnd(20)SongX;" or even "SongX;" should work, but it does not.... Am I way off?

Where might I get additional well-documented scripts to study?

User avatar
andy55
Site Admin
Posts: 569
Joined: Sat May 01, 2004 4:38 pm
Contact:

Re: Scripting newbie

Post by andy55 »

FunkyD wrote:I have a collection of sprites in the following directory:
/G-Force/Sprites/(Non-Auto)/SongX

The files are named 00SongX.jpg, 01SongX.jpg... all the way up to 20SongX.jpg

Now, suppose I wanted to create a script like "CTRL X.txt" that would randomly display all those sprites in that directory.

It seems like "rnd(20)SongX;" or even "SongX;" should work, but it does not.... Am I way off?

Where might I get additional well-documented scripts to study?
When G-Force 2.6.6 comes out (less than a week), use a script like:

StartSprite( sprintf( "%dSongX", rnd( 20.999 ) ) );

Since %d means integer, the decimal part of your random number will just get chopped off. Also note that the numbers woud go from 0 to 20 (21 possibilities in this case). If you wanted to to from 1 to 20, use something like:

1 + rnd( 19.999 )

User avatar
FunkyD
Posts: 6
Joined: Sat Jun 19, 2004 7:14 pm

Re: Scripting newbie

Post by FunkyD »

When G-Force 2.6.6 comes out (less than a week), use a script like:
That'd be as close to PERFECT as one could ask (for the money)! It appears that I may have been looking at scripting dox from a way older version of G-Force... or is the fortcoming scripting language syntax that radically different than it's predecessor(s)?

Will more new documented scripts come with 2.6.6?

Doot, do you sleep?


-d

Post Reply