How to Find the References to Game Variables
First, I'm unsure if this is supposed to be a question or a discussion, since I actually have a workaround.
Just to check with everyone else - how do you find which actors have references to a specific game variable? I found that the only way seems to be to attempt to delete the it. Doing that triggers a confirmation screen that presents the list of actors that have references to the concerned variable.
In addition to being risky (in case you press OK accidentally), it's still a difficult task, since you have to dig inside the behaviors to find them individually.
Any techniques you can share? Or is this a change on the way?
Just to check with everyone else - how do you find which actors have references to a specific game variable? I found that the only way seems to be to attempt to delete the it. Doing that triggers a confirmation screen that presents the list of actors that have references to the concerned variable.
In addition to being risky (in case you press OK accidentally), it's still a difficult task, since you have to dig inside the behaviors to find them individually.
Any techniques you can share? Or is this a change on the way?
Comments
when you make an attribute … name it so you know why it exists/what it does
(names do not matter to the computer … computer stores by an id#
… names are there for your ease in defining the attribute's purpose)
in your actor's behaviors … drag in a Note behavior
type/drag into that Note the gameAttributes actor accesses
in your rules … in the titleBar … type in the attribute(s) accessed
before you start deleting attributes … save a back-up project that is perfect
when done your deletions … if the new project works … you are good to go
as @FryingBaconStudios said: when you made the game you should know the attributes you used … worried you may forget? … then write them down
All components of the Game Salad project file are saved as XML files. Using the Mac console and the "grep" command, I'm able to find all occurrences a certain variable. It actually works as a global "find-in-workspace" solution.
Thanks for your inputs.
i think a search function in gs would be a nice addition maybe at the top of the rules a little box to enter text, or an attribute, (like an expression editor) and have it highlight all the matches in the rules below. especially since sometimes things get stuck in the otherwise section and can hide away in there.
that is the actor you are working in
… you should know if you created the attribute when you used it
however, when you do not make the needed changes in the actor … when you reopen that actor … GS will alert you of the now blank attribute fields
I created 5 actors in a dummy project and created 8 nested layers of rules, then used "MyVariable" in "Otherwise" section of Actor 5. It was still able to return the result.
1. In the Terminal, cd to the directory where your gameproj file is located.
2. cd MyDummyProject.gameproj
3. Issue this command:
grep -RH MyVariable *
4. In the result, there will be some text surrounded in a tag [text id="name"]. That's the actor that has reference to it.
The catch is that it will return any actor that even mentions that word in a Note, or a disabled rule. But it will save you from accidentally deleting something that's used.