Autostart events and global variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I actually have 2 questions to have answered.
I'm making a (small) RPG for a school project, using powerpoint. Going FAR
beyond the call, i plan to use macros to enhance the gameplay somewhat. I
need to make an inventory system, and i need a lot of things to happen
automatically, so i can control basically the entire application (with the
exception of backgrounds).

so, my 2 questions are:
1. Can i use global variables? If so, how? (otherwise known in C as externs)
2. How do i get a macro to run automatically when the user gets to a certain
slide? IE, the user goes to the world map, a macro should automatically run
to adjust the world map according to the player's status.


Thanks!
 
If you are using VBA (as opposed to external program control) then declare a
public variable outside of and above the subroutines to make it global. Any
subroutine in any module/form/class can now call this variable.

---- example----
Option Explicit

Public intQiver As integer

Sub TalkWithCharator()
......
---- end example-----

As for the automatic calling of a sub, you will need to create an event
capture. See:
**Make PPT respond to events
http://www.rdpslides.com/pptfaq/FAQ00004.htm


--

Bill Dilworth
Microsoft PPT MVP Team
Users helping fellow users.
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of your questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 
To make global variables, the easiest thing is to put all your macros in one
module and then declare all your variables at the top of the module. If you
have a need for more than one module, then be sure to declare your variables
as Public. Just about the only time you would NEED to have more than one
module is if you are using UserForms.

There are ways to trap events, but they rely on add-ins, which limit the
portability of your game (the add-in will have to be loaded on any machine
running it). An alternative, is to control all your navigation with VBA
macros. Then you can control what happens when you go to a particular slide.
I generally do this by having the first slide have a button that must be
clicked to continue. This button will call a procedure that does all the
housekeeping to make sure everything else is set up in the presentation.
Then, if I want something to happen when users go to a slide, that can be
handled by the macro that takes them to that slide.

--David

David Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top