Forum Discussion
WebObject and Storyline Variable
Hi!
I have a problem, I need to use a webobject with my project, but my webobject needs some informations. So, I put them in variables in Storyline and now my problem is how I can give them in the query string like this :
http://mywebobject.com/mysite.php?info1=VariableSL1&info2=VariableSL2
Do you have any idea?
Thank you very much!
- JasonJohnson2Community Member
I would love to see your example, Zsolt!
- SteveFlowersCommunity Member
One way to avoid having to edit external files is to add a JS trigger to the master slide. You can either write an include to the header or write window level functions that can be called later. I don't mind doing surgery after publish but it gets to be a bummer doing it every time.
window.getVariable=function(vName)
{
var player=GetPlayer();
var myVar = player.GetVar(vName);
return myVar;
}
window.setVariable=function(vName,vValue)
{
var player=GetPlayer();
var myVar = player.setVar(vName,vValue);
return myVar;
}
- JasonJohnson2Community Member
Hey Steve, I'm very interested to see a working sample of that. Do you happen to have one you could share? Nothing too elaborate just something in working order. Thx!
- SteveFlowersCommunity Member
Hey Jason -
Can take a look tonight or this weekend!
- KevinMcGloneCommunity Member
@Zsolt Olah: Thank you for the approach you provided.
I can get the variables out of Storyline which is great but when I try to set variables in storyline the function seems to breakdown ie it is not being fired.
Off course this is the functionality I need the most. I'm in the process of troubleshooting the issue.
Any suggestions as to why this isn't working going into Storyline? is there something in Storyline that I need to set to allow the variables to be written to?
- Jean-Guy-BoulayCommunity Member
deleted comment ... irrelevant
Hope it helps.
edit: I should point out, that I setup the setVariable in the story.html after the story.js loads.
function setVariable(vName,vValue)
{
var player=GetPlayer();
var myVar = player.SetVar(vName,vValue);
return myVar;
} - KevinMcGloneCommunity Member
Hi Jean-Guy,
Thanks for the reply. I will give it a try and report back here.
- KevinMcGloneCommunity Member
Changing 'Window' to 'Parent' in the Web object breaks the Web Object and there would be a high development overhead to re-develop in my case.
The strange thing is 'parent.getVariable' works ie it gets the variable from Storyline.
I might try getting the variable from within Storyline. - Jean-Guy-BoulayCommunity Member
Is your webobject code in the body or the head? I placed mine in the body. it's been a few months ago, but I recall I was getting no communication when I had the code in the Head of the webobject. I also added an eventlistener to ensure that the vars updated in the webobject before executing setVariable.
- ZsoltOlahSuper Hero
I just saw this chain, not sure why I wasn't getting notifications when someone replied... And it's been there for a while but if someone is still interested, I just had two sessions on using a game engine (Construct 2) with Storyline at the ATD TechKnowledge conference.
I put together an interactive guide book how to build a game with source files.
You may not work with a game engine but the output of the game engine is HTML5. Check out the section on Integration with Storyline. There's an example you can download with explanation how it works under: Playbook 4 Integration with Storyline 2 -> Integration package
http://rabbitoreg.com/atd-tk-integration-package/
My original blog example: http://rabbitoreg.com/2015/03/23/c2s2/
And here's one implementation to see it in action: http://rabbitoreg.com/2015/06/11/when-i-ruled-the-world/
- RichardHill-4f3Community Member
Hey Zsolt, could you relink the integration package if you still have it? The link seems dead. : (