Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Steeveeo

Need help with random textures.

Recommended Posts

I searched on the wiki and the Animdefs section is quite cryptic when it comes to some of the command descriptions.

So right now I am tryin to use ACS to make random textures.

script 996 (void)
{
int tex = random(1,10);
setlinetexture(3, SIDE_FRONT, TEXTURE_BOTTOM, "EQUAL"+"tex");
delay(1);
restart;
}
I tried to do "EQUAL"+tex (no quotes) but when the script was run it cycled thru my entire block of ACS coming up with hundreds of Texture not found errors in a matter of seconds.

I have ten EQUAL textures (EQUAL1 - EQUAL10) and I am tryin to call them up at random, but not even "EQUAL"+"random(1,10)" works (not even w/o quotes).

Can someone help me fix this?

Share this post


Link to post

strings can't be added in ACS. When a code like this

string = "a"+"b"
is executed,not the strings get added,but their indexes (1 and 2 in this case),so the variable string doesn't equal "ab" but it equals whatever string there may be with an index of 3.

your problem can however easily be solved by making use of an array:
str textures[10]={"EQUAL1","EQUAL2","EQUAL3","EQUAL4","EQUAL5",
"EQUAL6","EQUAL7","EQUAL8","EQUAL9","EQUAL10"};
script 996 (void)
{
int tex = random(1,10);
setlinetexture(3, SIDE_FRONT, TEXTURE_BOTTOM, textures[tex-1]);
delay(1);
restart;
}

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×