Jump to content
goldenfiver

Scripting a 'Power Point' presentation- need help

Recommended Posts

Hi guys,

I am trying to make a visual presentation using the 'user texture (10m)' object (found under empty->helpers).

A laptop calls those scripts via addaction:

 wall1 setObjectTextureGlobal [0, "textures\1.paa"]; 

and then

 wall1 setObjectTextureGlobal [0, "textures\2.paa"]; 

to change the texture of the object- which is like changing the slide. The problem is that I cant sync it for all players (only the one that uses the laptop can see the textures ).

Can it somehow be synced for everyone on the server?

-> it does work fine if called via radio trigger, is there anyway to activate a trigger using "addaction" script?

Share this post


Link to post
Share on other sites

Try

this addAction ["Slide 1",{[[{wall1 setObjectTextureGlobal [0, "textures\1.paa"];}],"BIS_fnc_Spawn",true] call BIS_fnc_MP;}];

Or if you want the action in a separate file and called through execVM

[{wall1 setObjectTextureGlobal [0, "textures\1.paa"];},"BIS_fnc_Spawn",true] call BIS_fnc_MP;

Edit: Fixed copy and paste error

Edited by Fight9

Share this post


Link to post
Share on other sites
Try

this addAction ["Slide 1",{[[{wall1 setObjectTextureGlobal [0, "textures\1.paa"];}],"BIS_fnc_Spawn",true] call BIS_fnc_MP;}];

Or if you want the action in a separate file and called through execVM

[{wall1 setObjectTextureGlobal [0, "textures\1.paa"];},"BIS_fnc_Spawn",true] call BIS_fnc_MP;

Edit: Fixed copy and paste error

The second one shows the picture for an instant and then its gone :( , can't get the first to work aswell

Share this post


Link to post
Share on other sites

-> it does work fine if called via radio trigger, is there anyway to activate a trigger using "addaction" script?

In the addAction parameter/onuse, include something like: trgactivate = 1;

In the cond. of a trigger that calls for it, include: trgactivate == 1;

Share this post


Link to post
Share on other sites

Thanks grimes, it does work but it wont sync. Only when I use radio triggers in-gamee it does.

Trying to work with Fight9's script, but it only shows the picture for a brief moment and them shows this error: Warning Message: Cannot load texture mpmissions\__cur_mp.altis\textures\fireteam.paa. (fireteam is my file name)

Share this post


Link to post
Share on other sites

Just found this topic, as I have been trying to do the same thing with some success. My only issue at this point is syncing JIP players.

I'm creating a function in init.sqf:

BRIEF_setObjectTextureGlobal = {(_this select 0) setObjectTextureGlobal (_this select 1)};

Then adding an action to an object such as a laptop:

BRIEFinit = this addAction ["<t color='#FFFFFF'>Start Briefing</t>", "BRIEFinit.sqf", [], -1, false, false, ""];

BRIEFinit.sqf:

_BRIEFinit = _this select 0;

slideArray = ["images\0.jpg","images\1.jpg","images\2.jpg","images\3.jpg","images\4.jpg"];
slideIndex = 0;
slides = count slideArray;

greenText = {"<t color='#00FF00'>" + _this + "</t>"};
redText = {"<t color='#FF0000'>" + _this + "</t>"};
whiteText = {"<t color='#FFFFFF'>" + _this + "</t>"};

player removeAction BRIEF1;
player removeAction BRIEF2;
player removeAction BRIEF3;

BRIEF1 = player addAction ["Next Slide" call greenText, "BRIEFnext.sqf", [], 99, false, false, ""];  //should be first in action list
BRIEF2 = player addAction ["Previous Slide" call whiteText, "BRIEFprevious.sqf", [], 98, false, false, ""];  //should be second in action list
BRIEF3 = player addAction ["End" call redText, "BRIEFend.sqf", [], -99, false, false, ""];  //should be last in action list

_BRIEFinit removeAction BRIEFinit;

BRIEFnext.sqf:

if (slideIndex >= (slides -1)) then {slideIndex = 0};
slideIndex = (slideIndex +1);
_slide = slideArray select slideIndex;

[[bigScreen, [0, _slide]], "BRIEF_setObjectTextureGlobal", true, true] call BIS_fnc_mp;

BRIEFprevious.sqf:

if (slideIndex == 1) then {slideIndex = slides};
slideIndex = (slideIndex -1);
_slide = slideArray select slideIndex;

[[bigScreen, [0, _slide]], "BRIEF_setObjectTextureGlobal", true, true] call BIS_fnc_mp;

BRIEFend.sqf:

player removeAction BRIEF1;
player removeAction BRIEF2;
player removeAction BRIEF3;
bigScreen setObjectTextureGlobal [0, "images\0.jpg"];

On approaching the laptop, you get the action "Start Briefing". This adds the actions "Next Slide", "Previous Slide", and "End" to the player, so you can move away from the laptop and still be able to control the presentation. You can comment out the last line of BRIEFinit.sqf if you want multiple players to have access to the briefing controls, or if you want the safety of being able to restart it if you accidentally hit "End". The first time you hit "Next Slide", the presentation begins on slide 1 (not slide 0) then advances to the end and loops back to slide 1. Hitting "Previous Slide" obviously moves the presentation backwards, also skipping slide 0. Selecting "End" will display slide 0 (a "splash" screen or whatever) and remove all three actions from the player.

You can add as many slides as you need, provided they are in the right location and slideArray is updated accordingly.

It seems to sync fine on dedi, except for JIP players, who advance the presentation by one slide when they join, and who can not see the textures at all. JIP compatibility isn't crucial for me, but it would be nice to fix for the sake of my mild OCD and for use by others.

Being a noob scripter, I'm sure that there are also some security issues regarding my use of globals, but it seems to me that this is a non-critical application and my missions will only ever run on my clan's private server anyway.

Edited by Harzach

Share this post


Link to post
Share on other sites
Just found this topic, as I have been trying to do the same thing with some success. My only issue at this point is syncing JIP players.

I'm creating a function in init.sqf:

BRIEF_setObjectTextureGlobal = {(_this select 0) setObjectTextureGlobal (_this select 1)};

Then adding an action to an object such as a laptop:

BRIEFinit = this addAction ["<t color='#FFFFFF'>Start Briefing</t>", "BRIEFinit.sqf", [], -1, false, false, ""];

BRIEFinit.sqf:

_BRIEFinit = _this select 0;

slideArray = ["images\0.jpg","images\1.jpg","images\2.jpg","images\3.jpg","images\4.jpg"];
slideIndex = 0;
slides = count slideArray;

greenText = {"<t color='#00FF00'>" + _this + "</t>"};
redText = {"<t color='#FF0000'>" + _this + "</t>"};
whiteText = {"<t color='#FFFFFF'>" + _this + "</t>"};

player removeAction BRIEF1;
player removeAction BRIEF2;
player removeAction BRIEF3;

BRIEF1 = player addAction ["Next Slide" call greenText, "BRIEFnext.sqf", [], 99, false, false, ""];  //should be first in action list
BRIEF2 = player addAction ["Previous Slide" call greyText, "BRIEFprevious.sqf", [], 98, false, false, ""];  //should be second in action list
BRIEF3 = player addAction ["End" call redText, "BRIEFend.sqf", [], -99, false, false, ""];  //should be last in action list

_BRIEFinit removeAction BRIEFinit;

BRIEFnext.sqf:

if (slideIndex >= (slides -1)) then {slideIndex = 0};
slideIndex = (slideIndex +1);
_slide = slideArray select slideIndex;

[[bigScreen, [0, _slide]], "BRIEF_setObjectTextureGlobal", true, true] call BIS_fnc_mp;

BRIEFprevious.sqf:

if (slideIndex == 1) then {slideIndex = slides};
slideIndex = (slideIndex -1);
_slide = slideArray select slideIndex;

[[bigScreen, [0, _slide]], "BRIEF_setObjectTextureGlobal", true, true] call BIS_fnc_mp;

BRIEFend.sqf:

player removeAction BRIEF1;
player removeAction BRIEF2;
player removeAction BRIEF3;
bigScreen setObjectTextureGlobal [0, "images\0.jpg"];

On approaching the laptop, you get the action "Start Briefing". This adds the actions "Next Slide", "Previous Slide", and "End" to the player, so you can move away from the laptop and still be able to control the presentation. You can comment out the last line of BRIEFinit.sqf if you want multiple players to have access to the briefing controls, or if you want the safety of being able to restart it if you accidentally hit "End". The first time you hit "Next Slide", the presentation begins on slide 1 (not slide 0) then advances to the end and loops back to slide 1. Hitting "Previous Slide" obviously moves the presentation backwards, also skipping slide 0. Selecting "End" will display slide 0 (a "splash" screen or whatever) and remove all three actions from the player.

You can add as many slides as you need, provided they are in the right location and slideArray is updated accordingly.

It seems to sync fine on dedi, except for JIP players, who advance the presentation by one slide when they join, and who can not see the textures at all. JIP compatibility isn't crucial for me, but it would be nice to fix for the sake of my mild OCD and for use by others.

Being a noob scripter, I'm sure that there are also some security issues regarding my use of globals, but it seems to me that this is a non-critical application and my missions will only ever run on my clan's private server anyway.

Hi there,

I'm trying to follow your advice but I didn't get where the images are "loaded". Do i need to create an object and name it BRIEF?

Thanks in advance

Share this post


Link to post
Share on other sites

Sorry, I forgot to specify. As per the first post:

...using the 'user texture (10m)' object (found under empty->helpers).

In my example, I have named this object 'bigScreen'. See the last line in BRIEFnext.sqf, BRIEFprevious.sqf, and BRIEFend.sqf for the reference.

And again, this does not work for JIP players. I don't know if there is a way to make it work, but that doesn't mean there isn't.

Share this post


Link to post
Share on other sites

Thanks a lot. I've found a mistake in this line

BRIEF2 = player addAction ["Previous Slide" call greyText(should be whiteText), "BRIEFprevious.sqf", [], 98, false, false, ""]; //should be second in action list

Cheers

Share this post


Link to post
Share on other sites
Thanks a lot. I've found a mistake in this line

Oops! The price of multiple revisions. Thanks, original post edited.

Share this post


Link to post
Share on other sites
It seems to sync fine on dedi, except for JIP players, who advance the presentation by one slide when they join, and who can not see the textures at all. JIP compatibility isn't crucial for me, but it would be nice to fix for the sake of my mild OCD and for use by others.

Not saying that your current system is bad, but you may be interested in publicVariable and addPublicVariableEventHandler

Using that method, you could just broadcast the texture name and have the clients set the texture locally, within the public variable event handler. This makes your presentation JIP compatible because JIP players will take the value of the PV from the last time it was broadcast and use that.

Share this post


Link to post
Share on other sites
... you may be interested in ...

Ah, yeah. I never got around to figuring that out. Maybe some day - though my work here is nothing special and anyone is welcome to 'fix' it.

Share this post


Link to post
Share on other sites

@Harzach your script is brilliant, unfortunately my knowledge regarding scripting is so poor right now :( , but I'll try to figured out something.

Using that method, you could just broadcast the texture name and have the clients set the texture locally, within the public variable event handler. This makes your presentation JIP compatible because JIP players will take the value of the PV from the last time it was broadcast and use that.

@Dreaded do you have any example on that?

Cheers

Share this post


Link to post
Share on other sites

@Dreaded do you have any example on that?

Chose a global variable name, then in init.sqf just use:

"VariableName" addPublicVariableEventHandler {object setObjectTexture VariableName};

What this will do is set the texture of object to the texture path you'll assign to VariableName whenever VariableName is used with

publicVariable "VariableName";

Since public variables are synced with JIP, it should set the texture on JIP (I think)

Share this post


Link to post
Share on other sites

Thanks. I think that I need more exercise to integrate addpublic to Harzach script..:j:

Share this post


Link to post
Share on other sites

I'll take a crack at something when I get home, I think you could just use an array of texture paths and then flick through the array with next/previous actions

Share this post


Link to post
Share on other sites
I think you could just use an array of texture paths and then flick through the array with next/previous actions

That's exactly what I'm doing.

Share this post


Link to post
Share on other sites
I'll take a crack at something when I get home

Did you try something :)?

Share this post


Link to post
Share on other sites

Sorry to post on old thread but how would it be possible to have more than one presentation board for my units training server i would like serveral, is this possible? Thanks

Share this post


Link to post
Share on other sites

Hi gents,

I realise that the original authors may be long gone. It's just that I (and other players) would probably enjoy having a slideshow script independent from the bells and whistles of ACE3 or ALiVe mods.

Have done some private testing. The script works fine in Single- and Player hosted Multiplayer, but doesn't on a Dedicated Server (JIP or otherwise). As is, clients will get an error that says the texture won't display. This is easily fixed by converting the mission to .pbo format. 

The next problem is that, every time a new slide (texture) is called, the image displays for a fraction of a second, then disappears. This occurs for every slide in the array. I rewrote the BRIEFnext script using remoteExecCall:

 

[bigScreen, [0, _slide]] remoteExecCall ["BRIEF_setObjectTextureGlobal"];  

 But this code gave the same result as above.

Is there anything that I am missing in the implementation? 

Share this post


Link to post
Share on other sites
9 hours ago, Melody_Mike said:

As is, clients will get an error that says the texture won't display. This is easily fixed by converting the mission to .pbo format.

This is a known problem: https://feedback.bistudio.com/T80668. The setObjectTexture(Global) command will take the server's mission root and try to find the texture in a folder that does not exist for the client. Maybe working around it with @killzone_kid's method might work (http://killzonekid.com/arma-scripting-tutorials-mission-root/)? 

Share this post


Link to post
Share on other sites

Good to know I am not the only one struggling.

I realise now even the ACE* mod developers had to deal with this: https://ace3mod.com/wiki/framework/slideshow-framework.html

But I have solved the "Can't find texture" problem, I think. Clients get no errors about "can't display" textures when the mission is in .pbo format. 

Current problem is that new slides quickly flash on the screen before going invisible to all users. This effect repeats (for the correct slide) every time "Next" or "Back" is activated. It only occurs in Multiplayer.

* (Why not use ACE? My group plays very casual, so I want to avoid mod dependencies, medical systems, and other doo-hickeys.) 

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

×