PDA

View Full Version : Setting Variables with Tokens



timeaton
04-16-2002, 08:21 AM
Hi!

I need to set a variable in Demoshield to be the same as the current resolution. I've tried a perform calculation event and pasted the token "<Global.Resolution>" in there, but that doesn't work. How can I do this?

What I'm trying to do: I'm saving the user's current resolution to a variable. Then I'm changing the resolution with an external program. After that, the demo runs. When the user exits, it runs a resolution changer again, with the variable saved from the first scene, to switch it back to what the user originally had. I had set the variables manually before, but I'd like to do it automatically, so that it can handle *any* resolution without me having to type them all in.

This is possible, right? How can I save that variable, or assign it to a global variable?

Thanks,
Tim Eaton
After Affects Productions

KimberlyH
04-16-2002, 09:35 AM
To set a Variable Object to the resolution the user is running at, I would recommend the following:

Create an intro scene to your demo that has a scene length of 0.1 seconds.

Next, create an Event Object for each of the resolutions you can check for (ie: 640x480, 800x600, 1024x768, 1152x864, & 1280x1024).

In the first Event Object, create a comparison to check if the user is running at 640x480. Under the True Actions assign a Perform Calculation action to set the Variable to an assigned value of 0640x0480.

In the second Event Object, create a comparison to check if the user is running at 800x600. Under the True Actions assign a Perform Calculation action to set the Variable to an assigned value of 0800x0600.

Set up the other three Event Objects to check for the next three resolutions and setup the Perform Calculation accordingly.

Set the Start time for each Event Object to 0.0 seconds. What this will do is, as soon as the demo is launched, DemoShield will trigger all five Event Objects. Only one of the Events will be correct. Therefore, the Event that has the correct resolution will write that value to the Variable.

I have created a sample demo for you to view.

I hope this helps.