playMaker

Author Topic: Custom Scripts: drop down list of variables[SOLVED]  (Read 4335 times)

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Custom Scripts: drop down list of variables[SOLVED]
« on: October 05, 2013, 05:14:43 AM »
Hi guys,

I am trying to create an action for Rain AI. What I would like to do is write get / set AI property actions.

So What I would like to do is display a drop down list of variables for the user to pick. They then enter in the name of the variable and can also select a playmaker variable to store the result in (assuming we are talking about the get action).

I have create an enum with a switch statement but I was wondering if there was a better way.

      public enum VariableType
      {
         FLOAT,
         INT,
         BOOL,
         STRING,
         VECTOR2,
         VECTOR3,
         VECTOR4,
         GAMEOBJECT
      }
« Last Edit: October 07, 2013, 08:51:51 AM by jeanfabre »
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom Scripts: drop down list of variables
« Reply #1 on: October 07, 2013, 03:23:54 AM »
Hi,

 Use FsmVar and then do a check using ErrorCheck and when the user selected a fsm type not supported you throw an error:


Code: [Select]
// Perform custom error checking here.
public override string ErrorCheck()
{
// Return an error string or null if no error.

return null;
}

bye,

 Jean

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Custom Scripts: drop down list of variables
« Reply #2 on: October 07, 2013, 07:45:18 AM »
Thanks Jean.

Is it possible to store a vector4 inside of a quaternion in playmaker.

I noticed there is not a FSMVector4.

I was thinking of using FsmQuaternion to bounce back and forth between quaternion and vector4.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Custom Scripts: drop down list of variables
« Reply #3 on: October 07, 2013, 08:06:32 AM »
This does not seem to work and I dont know why not:

FsmQuaternion storeValue
Vector4 vec4Value

storeValue.Value.Set(vec4Value.x, vec4Value.y, vec4Value.z, vec4Value.w);

or even
         
storeValue.Value.Set(10.0f, 10.0f, 10.0f, 10.0f);
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Custom Scripts: drop down list of variables
« Reply #4 on: October 07, 2013, 08:33:37 AM »
This is the error when i do:

         storeValue.Value.x = vec4Value.x;


error CS1612: Cannot modify a value type return value of `HutongGames.PlayMaker.FsmQuaternion.Value'. Consider storing the value in a temporary variable
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Custom Scripts: drop down list of variables
« Reply #5 on: October 07, 2013, 08:39:22 AM »
Sorry for the spam guys.

figured it out:

FsmQuaternion storeValue;
Vector4 vec4Value;
         storeValue.Value = new Quaternion(vec4Value.x,vec4Value.y, vec4Value.z, vec4Value.w);
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Custom Scripts: drop down list of variables[SOLVED]
« Reply #6 on: October 07, 2013, 08:58:57 AM »
Sorry for the spam guys.

I dont think I can use the FSMQuaternion as it just displays x y z values in the editor and changes them.

So values of 10 in each become 0.09xxx 0.07xxx 0.07xx 0.9xx

Do I need to create a FSMVector4?
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom Scripts: drop down list of variables[SOLVED]
« Reply #7 on: October 07, 2013, 09:11:01 AM »
Hi,

CS1612 only means that you need to create a variable in between. like:

 Quaternion _temp =   storeValue.Value;
_temp.x = vec4Value.x;
 storeValue.Value = _temp;

Try this.

 Bye,

 Jean

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Custom Scripts: drop down list of variables[SOLVED]
« Reply #8 on: October 07, 2013, 10:36:33 PM »
Thanks Jean,

I solved this problem but am facing a different one which is basically using the existing FSM variables with another plugin for Vector4 data.

I have replied in the topic:

FSMVector4
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith