Jump to content
Sign in to follow this  
caseymc

Need help with Dynamic In-Game Slide Show Script

Recommended Posts

Gents,

For those of you who have the time to help. I am trying to set up a mission template for ingame training missions that will utilize a slide show by inserting a .paa or .jpg onto an object.

mission layout:

/scripts/

/media/

mission.sqm

init.sqf

My instructor has an init line command to add two actions, previous slide and next slide. The goal is to just next and prev through slides, by add slides using a name standard, for the mission without having to add individual addActions for each slide.

init.sqf

if ((!isServer) && (player != player)) then
{
 waitUntil {player == player};
};

//variable Initializations
slideNumber = 1;

if (isServer) then {
publicVariable "slideNumber";
};


//Add Actions
player addAction ["Next Slide", "scripts\nextslide.sqf", "", 0, false, false, "", ""];
player addAction ["Previous Slide", "scripts\prevslide.sqf", "", 0, false, false, "", ""];

Previous Slide SQF

//decrease slide numbers then pass the texture change to board.
slideNumber = slideNumber - 1;
slideboard setObjectTexture [0,"media\slide%1.jpg",slideNumber];

Next Slide SQF

//Increment slide numbers then pass the texture change to board.
slideNumber = slideNumber + 1;
slideboard setObjectTexture [0,"media\slide%1.jpg",slideNumber];

My board is named "slideboard" and it accepts those .jpg's via init line. Also, if I make individual addActions to change it with static names it works, but very tedious and against the usefulness of good programming. Whenever I issue the action, the script does not change the texture, but the counter is working which I have verified by task hints. Is there something I am missing? Is my syntax incorrect for selecting the object?

---------- Post added at 22:59 ---------- Previous post was at 22:54 ----------

So after turning on show script errors, it seems the setObjectTexture command expects 2 arguments vice the 3 I am sending it. What is the proper way to do this?

Edited by caseymc

Share this post


Link to post
Share on other sites

slideboard setObjectTexture [0,"media\slide%1.jpg",slideNumber];

->
_pic = format ["'media\slide%1.jpg'",slideNumber];
slideboard setObjectTexture [0,_pic];

Think that should do it.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×