Can you auto check from a Table?
Impervion
Member Posts: 49
I'm trying to setup my load text from a chart.
Currently I have:
Column 1 = Box/Circle/Square etc
Column 2 = Text
Column 3 = Height
Column 4 = Length
When mouse is over "Box" set a text variable to "Box".
Then If the variable = "Box", spawn a text back to the Width/Height in Column 3/4 and show Text in Column 2.
Is there a way to auto check from my Table in Column 1, or would I have to do:
If "Box" do~
If "Circle" do~
If "Square" do~
For as many Actors that I have/need to show a text.
Thanks.
Comments
Sometimes people get into the small details of their rules (which is good...) without explaining the bigger picture. It's hard for me to visualize what you're trying to do but if you said, "Just like in Candy Crush where you have three symbols in a row..." or "The scene has a set of 5 actors stacked on top of each other and you click any actor to check for a match" then it gives me a sense of what you're trying to do. What is the bigger picture? How does your game work? I'm a bit lost so far, sorry!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Loading text for the actors, so skills/items/exp needed etc etc.
My plan was to have a Text's table.
So Row 1 might be "Sword"|"This item does 5 damage"|50|30
Row 2 might be "Axe"|"This item does 7 damage"|50|30
Row 3 might be "Bash"|"Bash the target doing current player damage +50%|50|50
And so on.
Then I made a Actor follow the mouse.
Then If mouse was over "Axe" set "Text" variable to "Axe"
Then within the Actor following the mouse I did - If "Text" = "Axe"
Spawn a Texture Back setting size to Columns 3/4
Set Text to " row 2, column 2"
So my question is would I have to do 50+ If Axe/Sword/Box/Circle(whatever), checks within the actor following, or is there a way to constantly/automatically check down the Texts chart via some variable magic?
Such as If you could set "Texts" to "Axe" and then it went down the rows until it found "Axe" and could just pre-load the Size values and Text instead of many many If "X" checks.
I'm still lost in the details and not getting what you're trying to do. Can you describe the game as you would to a friend who knows nothing about programming or GameSalad?
There are several things I'm finding confusing and I'm sure it's because you're new to GameSalad, which is understandable:
Is "Axe" the name of your actor? And is "Text" a game attribute called game.Text or a table named game.Text or something else?
I just have no clue here... you're spawning an actor named "Texture Back" and changing its width???
Again, I'm not really sure what the question is exactly but if you're wondering if you can search through a table's values, yes you can.
You're also mixing up words like tables and charts... if you can stick to what GameSalad calls things (Tables, attributes, scenes, etc.) it's usually easier to have a conversation here.
The one thing I can offer is that if you want an actor to use a certain row of table data, it's possible to do that by assigning each actor a self.row (integer) value or searching the table for the exact text (e.g. "Axe") or for the name of the actor (e.g. "Axe").
A screenshot or video of your game/idea would be really helpful at this point!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Agreed, although I can fairly easily work out what a 'varibale' is (an 'attribute'), I am less sure about a 'text back' or an 'auto check' or 'text chart' or what is meant by 'my load text' (etc etc), it's probably best to stick to GameSalad terms otherwise just use plain English.
Sorry for the confusion but I tried this earlier today - it almost works.
Game Variable - TextX
Actors - Text,Circle,Square,Fish,Jelly
Each actor has a "Mouse Over Event", which then changes TextX to:
Circle=1
Square=2
Fish=3
Jelly=4
ELSE
TextX=0
Actor Text - Constrains its X/Y to mouse position X/Y, Sets alpha to 0.
Attribute Check
If TextX =0
Change TextX to TextX+1
Else
Display Text - tableCellValue(game.TBText,game.TextX,2)
TBText is setup like:
Integer | Text
1 | Circle
2 | Square
3 | Fish
4 | Jelly
During "Play" nothing happens until I mouse over any of the Actors and displays the text properly. Which is great since I feel that the "automated" part is done and wouldn't need a absurd amount of "If X" checks.
The issue now is even without being on any actors(after initially mousing over 1) the Text actor always displays "Circle"(will display the proper text when over the desired actor however), I think I know why since in my check I was doing if its "0", add at least +1, and that would be the "Circle" text in the Table.
If anyone knows how I can get around this that would be great.
P.S I hope this is more clear, if not sorry as I feel it gets what I am doing across? Maybe.
I think I got it.
In Text Actor
If TextX > 0
Display Text - tableCellValue(game.TBText,game.TextX,2)
Seems to be working.