playMaker

Author Topic: key / string actions [SOLVED]  (Read 4017 times)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
key / string actions [SOLVED]
« on: August 06, 2019, 07:14:11 AM »
Hi, I have been trying with some success to implement a click to change input.

Reference:

https://hutonggames.com/playmakerforum/index.php?topic=12996.msg60642#msg60642

I'm missing something or doing something in the wrong order.

1 check is the mouse over the button

(yes) proceed to user clicks on the button

(No) do nothing, wait and return.

2 click on the button proceed to wait for time to press the button or move away=(do nothing)

3 waiting for time ( player prefs get the strings 1 - 4) wait and finish.

4 listen for key ( get key code to string) store result as button 1.

5 save the key (player prefs set the strings 1 - 4)wait and finish.

6 new key (string compare button 1 to button 2) equal then key is in use.
                                                                      not equal (update gui) finish. return to start state.

7. key in use (update gui with "X") wait and finish.
proceed to wait for new key

8 new key (get key code to string) store result as button 1.

9 save the new key (player prefs set the strings 1 - 4)wait and finish. Return to start state.

Just noticed that maybe i should be checking that the mouse has moved away more often?







 










« Last Edit: August 29, 2019, 05:44:26 PM by colpolstudios »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: key / string actions
« Reply #1 on: August 08, 2019, 02:11:23 AM »
Hi,

It's hard to tell as is, you'll need to debug more and maybe cut down your features in smaller chunck and make sure they work by themselves.

-------
 make sure you check out Rewire for all customizable Inputs, it's the reference and it will save you time and sanity :)

it's hard to pick up, so make sure you follow all tutorials and doc from page 1, once you understand it, you will never go back.

https://assetstore.unity.com/packages/tools/utilities/rewired-21676


You can also get in touch with the author to check if what you want to achieve is possible.

Bye,

 Jean

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: key / string actions
« Reply #2 on: August 08, 2019, 07:22:43 PM »
It took a while to figure out where I was going wrong, but I've fixed that for now.

I can now detect if the user chooses the same button.

I have not put solved yet as I need to test more combos.

I am NOT using rewired, I am positive that I can achieve a user-defined system using playmaker.

At present, I can get both left and right stick axis and define them for use.

I can now remap the buttons so that the user can choose to change them.

There are still bugs that I am slowly working through, hence my post on build settings.

I have a demo: without the ability to change user input in regard to aiming or shooting, but at present, the joystick controls for esp the right stick are for a Logitech dual action controller.

Unfortunately, when working in unity and exporting to web GL gives issues with controllers.

when I build the buttons and axis are changed, but I've lots of patience :)

I personally think with the help of the community, who own and use different controllers that if they participated with me I could develop a working system.

Without REWIRED.

Link to a working non rewired demo, however only specific to a logitech dual action controller.
   
https://simmer.io/@colpolstudios/mechanim-simple-ik-v-0-4

I thought the only way for a player character to target a user-defined target was with final IK or other paid solutions, but me and my crazy mind found a way to to it with playmaker.

Don't right off playmaker just yet!





 


colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: key / string actions
« Reply #3 on: August 11, 2019, 04:22:35 PM »
I am a little bit too quick to say that my issue is resolved.

At the moment, I can change only two buttons.

Once I add a third to the conditions I do not get the correct checking.

I am hoping djaydino Is looking into this post and would help me out.

I am using string compare to check if the button is already in use, but as I said once, I add a new button I run into issues.

Maybe an array would be the better option or a sting switch?




djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: key / string actions
« Reply #4 on: August 11, 2019, 07:27:03 PM »
Hi.
You can use a array and loop or use multiple string compares like this :



Make sure Action sequence is on

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: key / string actions
« Reply #5 on: August 12, 2019, 03:51:07 PM »
I don't know how to do that.
I can't find the action sequence

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: key / string actions
« Reply #6 on: August 13, 2019, 02:09:09 AM »
Hi,

 simply right click on the state where it's empty or click on the gear icon to the right and you have the first menu item being "Action Sequence", just toggle it.

 It's in the srceenshot he gave on the last post.

 Bye,

 Jean

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: key / string actions
« Reply #7 on: August 13, 2019, 06:17:56 AM »
Thank you Jean, got it now.

Djaydino, Unfortunately, I can't seem to work this out without some more help.

Request: Demo of how to set up a change user input. Please.


 

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: key / string actions
« Reply #8 on: August 15, 2019, 11:31:58 AM »
Hi.
You can use a array and loop or use multiple string compares like this :



Make sure Action sequence is on

Still trying, but with no success.

Although action sequence is on, In the screenshot attached you can see only the first string compare is checked.

The New Key and button 3 are clearly the same see attached image, however this action is not checked.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: key / string actions
« Reply #9 on: August 15, 2019, 01:46:43 PM »
Hi.
You should disable 'every frame'

if you enable  'every frame' on an action it will not finish as it will check continuously

so in sequence it can not go to the next action :)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: key / string actions
« Reply #10 on: August 16, 2019, 01:28:13 PM »
Thanks, that helped.

However, my fsm fundamentally is wrong.

Would you kindly, take a look at my playmaker template and possibly help.

I got as far as three buttons working, but the way that I go about this is wrong I'm certain.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: key / string actions
« Reply #11 on: August 18, 2019, 07:31:19 AM »
Hi.
I cant really test as images and materials are missing.

But i can see that you save the key before checking, you should first check if equal to one of the other button strings.

Also on the 'new key' state you have set a equal AND a not equal event.
in this way only the 1st string compare will be compared, all the rest will not be checked.

it should look someting like this :



Also you might want to use the current ui as gui is outdated.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: key / string actions
« Reply #12 on: August 20, 2019, 03:59:38 PM »
many thanks for your time and help djaydino.

Although I did get it working. I have not put solved yet, as I need to find a different solution.

As the question, is related thought best to keep this thread going.

There are 8 possible buttons.

Each button should have a specific ID and related user pref ID.

Could the user pick two buttons and swap them?

button 1 is shooting

button 2 is aiming

Clicking on button 2 and choose to swap with button 1, updating this change within the user pref.

Or

Clicking on button 1 and choose to swap with button 8, updating this change within the user pref.

I think an array would suit this best however, I have yet to work with an array.

Before I rush headlong into learning, would you mind pointing me into the best course of actions needed?

Thank you 





 

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: key / string actions
« Reply #13 on: August 21, 2019, 07:01:37 AM »
Hi.
Get the button on selected slot (old button) , then when selecting new button for the slot (new button).

Check other buttons if the new selected button is on one of the other slots, if so
place (old button) to that slot.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: key / string actions
« Reply #14 on: August 21, 2019, 05:58:43 PM »
I am working on this but may have to come back.

On hold temp :)