Rolling dice with Google Slides

Triggering throwing a dice in Google Slides

Copy this template for your own use

How do you create a throw dice action in Google Slides with visual feedback. That’s the question I set out to answer when I started this template. If you are interested in just using it for your own products and not so much the journey of getting there, you can skip ahead to the “Customising the template for your own purpose section”.

Customising the template for your own purpose

This template was created for you with no restrictoins. So you are welcome to change, copy, adjust as you see fit. You are also welcome to use it in your products that you might sell on TPT or elsewhere. The only thing I ask is that you keep the “MIT license” comment in the Script Editor in tact. If you make any further script changes, add them as a comment in that section too.

How do change the position and size of the dice?

If you want to change the position and size of the dice:

  1. Switch to Master View
  2. Go to the “Dice Layout” page
  3. Change the main dice image you see there
  4. Re-size it, move it to wherever you want
  5. Switch to normal view again and you good to go

You have to keep it in the page though, because it is used as a placeholder to be replaced with a new image.

Things I learnt creating the template

App Scripts is really powerful

There are a ton of things you can do with Google App Scripts. Google’s documenation on the whole aspect is also well covered. If you are looking to start down this avenue and have some scripting experience take a look at these examples: Getting started with App Scripts

App Permissions is necessary but not great experience for the end-user

Whenever you create a script that wants to make changes to the current document (like this template does when a new dice is rolled), the user has to give the Script Permission to do so. This can be a bit of a jarring experience for some users, especially kids. I rate once they have approved it a couple of times it gets better for them, but for the first time it can seem a bit intrusive. If you are going down this road with your script make sure you request the minimum amount of permissions for the script to run. You can also tag your script to say @OnlyDoc, which means this script only has access to this document.

Event System is not as extensive as PowerPoint yet

The one thing I missed the most is the ability to trigger certain actions when a shape or object is clicked. Unfortunately, in Google Script you can only trigger an action from the top bar menu or sidebar menu. Many of the events you have available in PowerPoint (like Selection has changed, button clicked etc.) are not available yet. Hopefully this is something that will be added in the future.

Summary

If you have some scripting experience, building something with Google App Scripts in GSuite can be rewarding. I think we are only just seeing the beginning of what is possible, and how we can better use it for schools and education.