GameSalad

I want to make a "next in line" actor to show next actor in the queue

Trebs222Trebs222 Posts: 17Member
edited March 21 in Working with GS (PC)

hey guys, i am struggling to wrap my head around this.

I want to make a tetris style "next block" mechanic to be viewable by the user and i am really struggling.
i have blocks that have letters inside of them that are randomly generated with a table and everytime space is pressed they are shot from a cannon. but i need that number that is going to be shot viewable through a different actor before it is shot. so the user can know what letter will be next a few seconds before.

i have fiddled around and have only made it asfar as getting my "next block" actor and my "bullet block" read the same number but they both just change to the same thing everytime i press space. i cant seem to make the "next block" different to the one being shot, let alone having the "next block" letter actually being the one shot next.

«1

Comments

  • pHghostpHghost London, UKPosts: 1,867Member

    Please DO NOT open multiple threads on the subject.

    @Socks explained to you that you will need to share a screenshot of your rules, because otherwise it it impossible to understand what it is that could solve your issue.

  • SocksSocks London, UK.Posts: 12,350Member, BASIC
    edited March 21

    Q1) I have a calculation that doesn't seem to work, I am adding together several numbers and then multiplying this by another number, the result I'm getting is not correct, anyone got any suggestions as to how I can fix this ?

    :) :p ;)

  • pHghostpHghost London, UKPosts: 1,867Member
    edited March 21

    @Socks said:
    anyone got any suggestions as to how I can fix this ?

    Take the number of threads opened on this topic, multiply by 6, divide by the number of threads opened on this topic, times (pi plus the number of days that passed since pi day).

    Take that number, punch it into your smartphone instead of your numerical password (remember, you need to have GS Viewer installed on the device first) and it will install a special GS Genius module into Siri/Google Now/Cortana.

    Restart the device and explain your problem to Siri/Google Now/Cortana. They will pop up the correct rules. You need to copy those, email them to your computer, save them as CSV. Go to GameSalad Creator Home > Tables. Create a new table. In the upper right right corner, click on Import CSV and select it on your disk. This will create an new actor with the correct rules. Copy-paste them to where they need to be.

  • SocksSocks London, UK.Posts: 12,350Member, BASIC
    edited March 21

    @pHghost said:

    @Socks said:
    anyone got any suggestions as to how I can fix this ?

    Take the number of threads opened on this topic, multiply by 6, divide by the number of threads opened on this topic, times (pi plus the number of days that passed since pi day).

    Take that number, punch it into your smartphone instead of your numerical password (remember, you need to have GS Viewer installed on the device first) and it will install a special GS Genius module into Siri/Google Now/Cortana.

    Restart the device and explain your problem to Siri/Google Now/Cortana. They will pop up the correct rules. You need to copy those, email them to your computer, save them as CSV. Go to GameSalad Creator Home > Tables. Create a new table. In the upper right right corner. Click on Import CSV and select it on your disk. This will create an new actor with the correct rules. Copy-paste them to where they need to be.

    I tried this but it didn't work, what should I change ?

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    If [condition for changing the current block]
         Change game.currentBlock to game.nextBlock
         Change game.nextBlock to [a random block]

    [Then in the actor used for displaying the next block:]

    Constrain attribute self.Image to game.nextBlock

  • Trebs222Trebs222 Posts: 17Member

    @tatiang said:
    If [condition for changing the current block]
         Change game.currentBlock to game.nextBlock
         Change game.nextBlock to [a random block]

    [Then in the actor used for displaying the next block:]

    Constrain attribute self.Image to game.nextBlock

    thanks so much. i did those steps but because my current block is random when my "next block" copies the image it copes the random letter part of it and both blocks end up different.

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    You'll need to show some information about how you have the rules set up.

  • Trebs222Trebs222 Posts: 17Member
    edited March 22

    @tatiang said:
    You'll need to show some information about how you have the rules set up.

    alright i have attached my project so far, sorry for doing it before i am just abit shy about it cause i am only new and i am abit insecure around all you advanced guys cause my code might look really shitty.

    https://dropbox.com/s/zejqa8af5z06yy6/Letter%20Cannon%20project1.zip?dl=0

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    That's understandable but it's the only way to learn GameSalad better. Describing the problem often doesn't provide enough information. I haven't looked at your file yet but you may want to explain where to look (e.g. which scene, which actor, etc.).

  • Trebs222Trebs222 Posts: 17Member

    @tatiang said:
    That's understandable but it's the only way to learn GameSalad better. Describing the problem often doesn't provide enough information. I haven't looked at your file yet but you may want to explain where to look (e.g. which scene, which actor, etc.).

    thanks so much.scene 1. the top left grey square "next bullet actor is what i want to display the next letter to come out of the cannon and the orange "bullet actor" is what i want to be copied from the next bullet actor. so the next bullet grey actor has to display the bullet coming out of the cannon before it comes out. my letter table is where all the letters are stored. i cant seem to work around the fact its pulling random letters for the next bullet actor and the bullet actor.

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    My guess is you're doing something like this:

    Display Text [tableCellValue(tableName,random(1,26),1)]

    Where you should be storing the random value first like this:

    Change attribute game.nextLetter to tableCellValue(tableName,random(1,26),1)
    Display Text [game.nextLetter]

    ...but I'll take a look at your file and see if that's not the case.

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    Yep, I was right. :)

    Your Display Text behavior is again randomizing the value. Just change it so you're displaying the value that was already chosen:

  • Trebs222Trebs222 Posts: 17Member
    edited March 23

    @tatiang said:
    Yep, I was right. :)

    Your Display Text behavior is again randomizing the value. Just change it so you're displaying the value that was already chosen:

    thanks for your help again, i tried it and i think i set it up correctly but the bullet and the next bullet letter is changed at the same time rather than next bullet being shown as for example ""A" first until space bar is press and then the bullet that comes out of the cannon should be "A" rather than them being changed at the same time. Ontop of that when i hit space again every bullet then changes to the same next letter rather than staying their own separate entity. i have attached the file so you can see what i mean.

    i feel bad asking for so much help :(

    https://dropbox.com/s/zejqa8af5z06yy6/Letter%20Cannon%20project1.zip?dl=0

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef
    edited March 23

    Create a text attribute called self.myLetter in the Bullet actor. Then change the rules in the Bullet actor to these:

    You could simplify things and use self.myLetter in the first Change Attribute behavior but I'm assuming you might need that value outside of the Bullet actor which is why I suggest leaving game.Bullet there.

  • Trebs222Trebs222 Posts: 17Member

    @tatiang said:
    Create a text attribute called self.myLetter in the Bullet actor. Then change the rules in the Bullet actor to these:

    You could simplify things and use self.myLetter in the first Change Attribute behavior but I'm assuming you might need that value outside of the Bullet actor which is why I suggest leaving game.Bullet there.

    holy crap it worked wow i have been trying for so long srsly you are a genius tatiang, wow i am so happy right now :) is there a way i can check out your games or maybe buy some to help you out or id love to see someone as smart as yourselfs games they would be so good :)

    also i kinda have a few more questions i have been trying to figure out while trying to solve this problem, may i ask them here to you?

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    Yay! That's kind of you but I don't have any games that are still available on the app store. I've done a lot of GameSalad consulting over the years to help people build their apps but haven't published much. There are many more talented people here than me... I'm often in awe. And yes, feel free to ask questions here... that's what the forums are for. I may or may not have time to help but it's likely someone will answer you.

  • Trebs222Trebs222 Posts: 17Member

    @tatiang said:
    Yay! That's kind of you but I don't have any games that are still available on the app store. I've done a lot of GameSalad consulting over the years to help people build their apps but haven't published much. There are many more talented people here than me... I'm often in awe. And yes, feel free to ask questions here... that's what the forums are for. I may or may not have time to help but it's likely someone will answer you.

    i think you should you are very knowledgeable, but maybe you dont have time? thats ok though i dont either but i am chipping away everyday getting stuff done :)

    before i work on my game anymore though i am just wondering if this might be possible:
    i plan to add words or like a dictionary csv to a table. is there a way i can make it so when bullets are stacked ontop of eachother and lets say they are shot and 3 blocks stack up and spell [d][o][g] for example, that the game can somehow recognise these separate entities (bullets) as an actual whole word from the table. i am really confused cause i dont see how i can make these separate letters be recognised as words because each bullet is separate.. i dont have it close to set up atm and i dont expect you to know how to do it but i just want to know if its even possible because then the game just wouldnt work and i wouldnt waste time if i continued.

    thanks so much again, i owe you so much :)

  • pHghostpHghost London, UKPosts: 1,867Member

    Yes, that should certainly be possible. You can 'add up' the letters in an attribute or table, so they spell out a whole word. Then you can use that to search a table (dictionary).

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    As long as you have only one cannon, it's fairly straight forward. Each time a letter is stacked, change attribute game.word to game.word..game.letter (i.e. game.bullet). That will concatenate each letter onto the end of the game.word attribute. You can then search a table of words (a single column) for game.word.

  • Trebs222Trebs222 Posts: 17Member

    @tatiang said:
    As long as you have only one cannon, it's fairly straight forward. Each time a letter is stacked, change attribute game.word to game.word..game.letter (i.e. game.bullet). That will concatenate each letter onto the end of the game.word attribute. You can then search a table of words (a single column) for game.word.

    alrighty i have done the first two steps as you have listed and i watched some table search videos but i just cant seem to put it all together so it works and i am having abit of trouble with the search table function. i dont really want to display text i just want the search to happen, am i changing attribute from game.word..game.bullet to tablesearch(...). i dont know if the mac is different but i am getting invalid expressions alot. i have it attached, its in the bullet actor, thanks again :)

    https://dropbox.com/s/ivlj6ylifbsj3yb/Letter%20Cannon%20project1.zip?dl=0

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    I don't see a tablesearch function in the bullet actor. I find that function to be the most confusing in GameSalad. A demo may help you understand it better. Sorry, it's a Mac version but if you Google convert mac gamesalad to windows you should find directions for opening it.

  • Trebs222Trebs222 Posts: 17Member

    @tatiang said:
    I don't see a tablesearch function in the bullet actor. I find that function to be the most confusing in GameSalad. A demo may help you understand it better. Sorry, it's a Mac version but if you Google convert mac gamesalad to windows you should find directions for opening it.

    alrighty so i managed to set something up something here, in the bullet actor (down the bottom) i managed not to get invalid expression anymore, and my game lags abit now when the bullets touch which i am presuming its searching through all the words? i dont know if my concatenation is wrong but, just for now i set it up to display text(just to see if it work) if a word was found but i can only ever get a 0 to show up., but because it lags i am presuming it is searching. i have something in the wrng place somewhere. i am just about to head off to 12 hours work so i thought id ask while i am gone.

    https://www.dropbox.com/s/ivlj6ylifbsj3yb/Letter%20Cannon%20project1.zip?dl=0

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef
    edited March 27

    This is what I see in the Bullet actor:

    Where is the tableSearch function?

    Table searches are VERY fast and shouldn't lag at all. There may be some other reason for the lag such as a timer or constrain behavior.

  • Trebs222Trebs222 Posts: 17Member
    edited March 28

    @tatiang said:
    This is what I see in the Bullet actor:

    Where is the tableSearch function?

    Table searches are VERY fast and shouldn't lag at all. There may be some other reason for the lag such as a timer or constrain behavior.

    ok i will get to the bottom of the lag. but i think i uploaded an old version of it, this should work :)
    down the bottom of the bullet actor in the"adding letters part"

    https://dropbox.com/s/6r5gboyvnacrcpk/Letter%20Cannon%20project3.zip?dl=0

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef
    edited March 28

    When I tried replacing your tableSearch key (game.Word) with an existing text string ("zymotic" from row 172815), it found it. But with game.Word, it returns 0. I don't exactly know how your game works but if I add a Display Text to show the value of game.Word, it's either blank or "0". It's not displaying any letters.

    Your tableSearch expression looks fine. Now you have to troubleshoot game.Word. ;)

    Edit: I think the problem is that you're changing the value of game.Word to add game.Bullet but then immediately replacing the value of game.Word with a tableSearch result. I wouldn't recommend changing an attribute to a search for that attribute as you're doing here... use a different attribute for the result:

    You may also run into a problem where two bullet actors collide and they both run the collision rules at the same time, trying to change the value of game.Word and trying to do a tableSearch simultaneously... that's probably your lag. Consider something like this instead depending on how your game should function:

    Bullet actor

    When actor collides with [Bullet]
         Change attribute game.hit to true

    Another actor

    When attribute game.hit is true
         [tableSearch, etc.]

    That way, no matter how many collisions there are, the search only triggers once.

  • Trebs222Trebs222 Posts: 17Member

    @tatiang said:
    When I tried replacing your tableSearch key (game.Word) with an existing text string ("zymotic" from row 172815), it found it. But with game.Word, it returns 0. I don't exactly know how your game works but if I add a Display Text to show the value of game.Word, it's either blank or "0". It's not displaying any letters.

    Your tableSearch expression looks fine. Now you have to troubleshoot game.Word. ;)

    Edit: I think the problem is that you're changing the value of game.Word to add game.Bullet but then immediately replacing the value of game.Word with a tableSearch result. I wouldn't recommend changing an attribute to a search for that attribute as you're doing here... use a different attribute for the result:

    You may also run into a problem where two bullet actors collide and they both run the collision rules at the same time, trying to change the value of game.Word and trying to do a tableSearch simultaneously... that's probably your lag. Consider something like this instead depending on how your game should function:

    Bullet actor

    When actor collides with [Bullet]
         Change attribute game.hit to true

    Another actor

    When attribute game.hit is true
         [tableSearch, etc.]

    That way, no matter how many collisions there are, the search only triggers once.

    very helpful once again :), i managed to fix the lag by doing exactly what you said, such a great feeling when i finally get it right but my game.word is still showing 0 once i made a new actor to search the table. i must be doing something wrong on my end because i couldnt even search my own word like you did :(

    i made a new white box display text actor do the lag fix and try to search tables from there but yea just getting 0, i am probably missing something but my brain doesnt work after a long day at work :( srsly appreciate so much you helping me out.

    i have tried searching for game.word and game.word..game.bullet and both 0.

    https://www.dropbox.com/s/gw49mkjj4jlwjuk/Letter%20Cannon%20project4.zip?dl=0

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    When I said you have to troubleshoot game.Word, I meant that that's the attribute that isn't getting the value you expect. Since game.Word is built from other attributes (e.g. game.Bullet), you might start by checking the value of game.Bullet either with a Display Text or Log Debugging Behavior. And then if game.Bullet is affected by other attribute(s), you'd want to do the same for those until you've identified the cause.

  • Trebs222Trebs222 Posts: 17Member

    @tatiang said:
    When I said you have to troubleshoot game.Word, I meant that that's the attribute that isn't getting the value you expect. Since game.Word is built from other attributes (e.g. game.Bullet), you might start by checking the value of game.Bullet either with a Display Text or Log Debugging Behavior. And then if game.Bullet is affected by other attribute(s), you'd want to do the same for those until you've identified the cause.

    ok so i did alot of troubleshooting and i managed to get the letters adding up kinda nicely. i put a blank bullet at the bottom so the first bullet registers, i can change this up its abit sketchy right now. two problems, the first letter that collides adds 2 of that letter to the display text for some reason and all the letters after just add themselves to it, e.g. if the first letter you drop is an A for example, AA appears in the display text.

    Also i cant seem to make the game register that the player has made a word and take action ( e.g destroying the blocks once a word as been spelt therefore making more space for more words.)

    these search tables hell tough.

    https://www.dropbox.com/s/a87cg7bpxjuc85p/Letter%20Cannon%20project5.zip?dl=0

  • tatiangtatiang Posts: 10,632Member, Sous Chef, PRO, Senior Sous-Chef

    It sounds like it's getting a bit complex to troubleshoot and I'm not sure I have the time to help you further right now. Maybe someone else can add to this thread...

  • RThurmanRThurman Posts: 2,674Member, Sous Chef, PRO

    @Trebs222 -- there are multiple things going wrong. Here are a few:

    1) you get double letters to start because both bullet actors have the same letter and both fire their rule when they collide.
    2) you forgot to "prime the pump" by setting next letter at the start
    3) table search returns the row number of the found word (not true or false)
    4) words are made out of capital letters -- but the table only has words in lower case. The table search function is case sensitive.

    Here is a slightly cleaned up version.

«1
Sign In or Register to comment.