PlayMaker Help & Tips > PlayMaker Help

Need help creating custom keyboard [SOLVED]

<< < (2/3) > >>

Vallar:
Ah, glad to see it worked out, congratulations! :D ;D

As for backspace that is a tricky one, not sure if I can manage to get it right for you however, let's take the previous example mentioned with Var1 and Var2 (just so that we are trying to limit the number of variables to a manageable number). I am afraid I couldn't find anything related to arrays or even groups (if it uses a different name) in Playmaker.

What you suggested seems the best yes. Though, you can try something (but I guess this will work perfectly if you are going to only delete the last letter typed); from the previous example, the last letter should be still stored in Var1 even if you have pressed the backspace since from my own understanding that isn't a "letter" it is a bool variable if the player presses it deletes stuff if not, keep going. In which case I would use a "String Contains" action in Playmaker and enter String Variable parameter as Var2 and Contains String parameter as Var1, the event if true would be to alter the String (using String Builder again) and if false would do nothing.

Though I don't believe this will work for more than one letter unless you implement what you mentioned with making 10 variables and limit the characters entered in the text field.

I believe this might be done however in another way, yet it might be a little bit complex. Here is how:

You will need the following variables:
letterEntered (Var1 in previous example) - String Variable
stringTyped (Var2 in previous example) - String Variable
stringLength (new variable) - Int Variable.
lengthToRemove (new variable) - Int Variable.

The scenario would be as follows:
lengthToRemove initialized to 0
1- Player enters letter "U"
2- letterEntered = U
3- stringTyped = U, stringLength = Length of stringTyped = 0
4- Player enters letter "N"
5- letterEntered = N
6- stringTyped = UN, stringLength = Length of stringTyped = 1
7- Player enters letter "I"
8- letterEntered = N
9- stringTyped = UNI, stringLength = Length of stringTyped = 2
10- Player presses Backspace once

The States:

Setup:
In same state as the letterEntered have stringLength increment by 1 and the String Builder do its own normal trick as before (you will just add one more action to increment the stringLength variable).
Create two Events:
1- BackspacePressed
2- FINISHED (default) this is when backspace isn't pressed.

When backspace is pressed which you will test in the state you have the letterEntered change it would trigger BackspacePressed and that would go to a state that will have actions:
1- Subtract from the stringLength 1 (since it was pressed once).
2- Use Get String Left (action in Playmaker) and feed the String Variable parameter stringTyped and the Char Count parameter stringLength.
3- Increment lenghtToRemove by 1 (so when the action is repeated the variable is already incremented to delete the second last letter and so on).

That should get you the required result, when the player/user presses backspace again it should increment lengthToRemove by 1 and from 0 it goes to 1 and so on.


I hope this help.

cablebob1:
Cool. I think I mostly understood what you were saying.

Is this kinda what you are saying?

Get String Length
Length is "5"
Save this value to Int1
Int1 - 1 = New String Length

So you are pretty much just finding out how long your string is, subtracting 1 and setting your string length to the new value. The only thing I'm not sure of is how to set your string length.........?

This was the idea I came up with yesterday but wasn't sure how to implement the set string length.

Thanks for the help!

Vallar:
To set the string length have a state check if the player/user pressed a button and once it presses that button do a Add Int action which will add -1 (which is subtracting) to stringLength variable.

Hope that helps.

Edit: Don't forget to test the variable for its value first so if the stringLength is by whatever logic was set to 0 by mistake the Add Int action won't trigger, if that happens then the string will reverse its display functionality.

So for instance if the player/user didn't type anything and they pressed the backspace make sure it loops back and do nothing; if it goes through normal loop you will find that your stringLength now is -1 and will increase in negative form each time the player/user presses backspace with no text typed. Now if the player/user types anything for real and tries to delete anything, it will do the reverse (displaying the letters he wants to delete rather than the ones he want to keep).

cablebob1:
I feel really stupid like I'm missing something that it right in front of my face. Sorry for asking stupid questions but how do you set string length? I understand the math and logic behind it but I don't know how to set string length. I understand getting the string length but I can't figure out how to SET it.... can you do that in Playmaker or do you have to write a script that set's how many characters your string can have?

Sorry for all the trouble. I do appreciate the help though.

Alio:
Not sure if im on the same page as you guys, but maybe you might have to set up another variable as max string length 10 for example and then do a compare where if its greater than 10 return null or have a font pop up on screen that states something along the lines of "Maximum allowed characters reached" or something like that so that the players know.

If less than or equal to maximum allowed characters return back to state to allow player to enter more characters, if greater than maximum allowed flow to new state that tells them they have reached maximum and have that cycle back to previous state.  this way it will allow them to backspace, re-enter characters, or press key/function to complete input and sent event/message to next state that you intend them to go into.

Hope thats what you were looking for if not im sorry lol.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version