Jump to content
Sign in to follow this  
swatdog

I'm such a noob...

Recommended Posts

Ok, so I'm a little embarassed to ask this question, especially since I'm quite an advanced PHP scripter, but CANNOT figure out why this *VERY* simple script isn't working. Maybe I'm going about it the wrong way, but this is what I have:

_num = round(random 1)

_veh = format["at_%1",_num]

{_x moveInCargo _veh} forEach units group wl

As you can see, I just want the group of the unit named "wl" to board a randomized vehicle upon script execution. I have a naming convention with the vehicles as "at_*RANDOM*", random being the number that was generated by the random command at the beginning.

The problem is that the moveincargo command isn't successfully executing. My guess is because of the _veh variable, as I can hard code the vehicle's name, and it works. Maybe I have that wrong.

Any ideas?

I suppose I could also create an array of vehicles willing to take the group, but I also need whatever vehicle that doesn't have the specific group in it, occupied another group.

Share this post


Link to post
Share on other sites

Try replacing....

_veh = format["at_%1",_num]

with....

call compile format ["_veh = at_%1",_num];

See if you get some joy. As you have it there.... _veh ends up being a STRING and not an OBJECT!

EDIT: Forgot to scold you... lol! Go stand in the corner! Next time use a more descriptive header for your post. "I'm such a noob" doesn't help anyone that's searching for answers.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites
Try replacing....

_veh = format["at_%1",_num]

with....

call compile format ["_veh = at_%1",_num];

See if you get some joy. As you have it there.... _veh ends up being a STRING and not an OBJECT!

EDIT: Forgot to scold you... lol! Go stand in the corner! Next time use a more descriptive header for your post. "I'm such a noob" doesn't help anyone that's searching for answers.

Thanks, I will try this out.

As to your scolding: It got you to look at it didn't it? :)

Thanks for the suggestion.

Share this post


Link to post
Share on other sites
Guest

What happened to this?

§22) Use descriptive thread titles

If you start a new thread, please make sure your thread title explains what you want without forcing people to read through your post first. Thread titles such as "How in the world do I...", "Need help!" or "Will we ever see..." are anything but descriptive. We do not allow these kind of titles and threads with such titles are subject to be closed.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×