How do I make a report state for scene straits? - actions-on-google

I saw in GG docs for scene traits. But they don't have states of scenes. Should I make a report state of the scene traits for GG? Please help me

If a trait has no states to report, then you wouldn't perform a report state for it. You can set the field willReportState: false for that device.

Related

How to implement a toggle switch inside a nested array in a FieldArray in Formik?

quite new to Formik and FieldArrays. Any help is much appreciated.
The problem:
I have a FieldArray which renders a list of objects each having some Fields, a deleteCurrentObject and a addNewObject button . I have successfully implemented the functionality of adding new object and deleting the current one. What I need to implement and still have not found a solution to this is a toggle switch for each of the nested objects inside this FieldArray that will change the state of each object in the parent FieldArray. To be more specific, I need to be able to disable one or more of the Fields (inputs) depending on the status of the toggler. For this reason I have included in the ionitialValues of the FieldArray an isEditing boolean property, with the hope of switching its state from true to false. I have managed to do this with the help of setFieldValue or directly but the problem with this approach is that once the isEditing value of each object inside the FieldArray is changing, the change is not propagated down.
In any case , any indication of how to implement a toggle switch inside each object of a FieldArray is deeply appreciated.

UE4 Test if pawn is controlled pawn

I made up a C++ ThirdPersonExample project. I added several ThirdPersonCharacter BP. (TPC BP) I added a variable to the TPC BP.
I play as one of the TPC BP's. The other ones are controlled by AI.
In Event Graph of TPC BP, on Event BeginPlay, I want to set a variable if this current instantiated TPC BP is the controlled pawn - ie it's me playing!
I see that you can set variables.
However:
I only want to set a variable if I'm not the Controlled Pawn
I want to also set another variable if I am the Controlled Pawn.
I may be thinking of this the wrong way...any help appreciated.
I think that the easiest solution would be:
Add Event Possessed to TCP BP. This should be fired when your pawn (character) is possessed by a controller.
Since previously mentioned event has parameter - reference to a possessing controller, you can then try to cast that reference to PlayerController and AIController ( or their descendants).
Final step is to implement specific code for both types of possessing controllers (when cast was successful).

Are UE4 Blueprints the same with a C++ class? If so, how will I implement a class design?

Good day! I am new to using Unreal Engine 4 and I have a few questions about how exactly blueprints work. From my understanding of it, every blueprint works like a class. By that I mean one blueprint is much like one class in an OOP programming language.
Please educate me as to - if my assumption is correct or wrong. If wrong, then maybe you could help me achieve what I want in a different method/perspective. I am willing to learn and accept suggestions.
If at some point my understanding is correct - that blueprints are actually individual classes - I would really appreciate it if you could (please) guide as to where to go and how to implement a design that I want to create. This is from a programmers perspective (PHP OOP Programming). Forgive the approach, I'm just using PHP to logically express how I want the class to work. Plus, it is the only OOP programming I know atm.
I want to create a class named: Items. class Item {}
This class is going to handle everything item related, thus we will have to give it a lot of properties/variable. (Below is just an example; Again I'm using PHP as an example.)
class Item {
var $id;
var $name;
var $description;
var $type;
var $subType;
var $mesh;
var $materials;
}
3.) I would like to initiate this class by having two variables as its construct arguments. (We will require itemID and itemType). This is because I will use these two variables to retrieve the item's data which is already available in a data table. I will use those data in the table to populate the class properties/variables. (I'm not sure if I said that right. I hope you understood my point anyway.)
class Item {
var $id;
var $name;
var $description;
var $type;
var $subType;
var $mesh;
var $materials;
function _construct($cons_itemID, $cons_itemType) {
/*-- Start getting the item Data here based on what item and type provided. Then, push that data into the class properties/variables. We will use individual methods/functions to fill other properties/variables later. --*/
}
}
4.) Basically with that design I could easily pass on an item ID to the class and then get the item's name, description, mesh, materials and etc using pointers.
Example:
$weapon = new Item('10001','Weapon');
$weaponMesh = $weapon->getMesh();
$armor = new Item('12345','Armor');
$armorName = $armor->getName();
I'm just having a lot of trouble working with blueprint and achieve this method or even something similar to it. I'm not trying to avoid C++, I would love to learn it but I just don't have the time freedom right now.
Few things I have tried to make it work:
Casting / Casting to class (But I couldn't figure out what the target object will be and how was I going to add input arguments into the class that way? There isn't any input there that I could use.)
Spawn Actor (This one is very promising, I need to dig in deeper into this)
Blueprint Macros? Blueprint Interfaces? (I'm just lost.)
For all those who will help or answer. Thank you!
~ Chris
So far as I know, yes, we can assume that each blueprint can be viewed as class. (Moreover, since UE 4.12 (in UE 4.11 that functionality is marked as experimental I think) you can check Compile blueprints under Project settings -> Packaging. That will create native class for each blueprint.)
You can create either Blueprint or C++ class based on Object (UObject in C++). Then you can specify all properties (or variables in UE editor terminology). In BP you have small advantage: you can mark some properties as Visible at spawn (they must be Public and Visible). So when you are creating new instance of that class, you can explicitly pass values to that properties.
And in BP Construct event, that properties are correctly filled, thus you can set another properties values based on given ID and Type.
In C++ class having different arguments than FObjectInitializer is not possible, thus you don't have that values in time when constructor is executed. But it is not so hard to achieve same functionality, you can find example here: https://answers.unrealengine.com/questions/156055/passing-arguments-to-constructors-in-ue4.html.
Something about list of what you had tried:
Spawn actor - derive from actor only if you intend to have that BP in scene. Actors are subjects to game updates and rendering, so having actor only as data container is very wrong.
BP Macro is same as BP Function except function will be called just like function (so executing necesary actions by function call conventions) and macro will replace it's implementation in place, where you are calling that macro. More exhausting explanation here.
If I would implement your code, I'd do it like I said and then I'll have that class as property in some component and that component would be attached to some actor, which would be placed in scene.

How to reference a stage instance of a MovieClip from a non-document Class without causing Error 1120?

I have a basic AS3 question that has to do with the relationship between object on the stage and objects that are created and controlled by AS3 script. This question has already been addressed tons of times, and I've researched it for hours, but I found drastically different answers, many which were really complicated. I'm looking for the simplest, most general solution to this issue that is humanly (or perhaps I should say computerly) possible.
I want to be able reference an instance of an object on the stage inside a class that is not the main document class. Before I try to explain in my own terms, it might be better to view one of these posts, which cover the exact topic I'm confused about. If any of you understand the issue, and understand the solutions to one of these posts, perhaps you could translate one of the correct answers into n00banese for me. Rather than just focusing on how they did it, you could explain WHY it was necessary to do it that. I would be very thankful if someone could do that much, and if you can it is not necessary to read any further into this post.
AS3 - Access MovieClip from stage within a class
How do I access a MovieClip on the stage from the Document Class?
AS3 Modify stage Objects from a class
how do I make non-document-class classes 'aware' of stage components in Flash AS3?
Accessing ActionScript3 Nested Movie Clips from Class
Since it's highly possible that all of the above-mentioned situations are too complicated for me, I recreated the problem in the simplest, most general way possible in hopes that it would be easier to explain in this case.
I have a MovieClip on the stage with instance name scene_mc. scene_mc does nothing except separate one scene from another. It's linked to a .as file named Scene. Nested inside scene_mc there is a movieclip called thing_mc, linked to .as file Thing. I want to move thing_mc across the scene. I could easily do this by changing its coordinates in the main document class, something like this:
thing_mc.x = thing_mc.x + 100;
But since thing_mc is nested inside of scene_mc, I would like to control thing_mc's position inside the SCENE class so that the coordinates are relevant to other nested symbols in this class. And because in more complicated projects, it just makes sense to control a nested symbol in the code of its parent. So inside Scene.as, I might create this method:
public function moveThing() {
thing_mc.x = thing_mc.x + 200;
}
This causes this error: "1120: Access of undefined property thing_mc."
Error 1120 happens any time one tries to reference a stage instance of a symbol a .as file that is not the main document class.
So to reiterate my question, how can I let the Scene class know what thing_mc is? Or how can I let any class know what any stage instance is? How do you reference a stage instance of an object through a non-document class?
Oh! This might be helpful. The Actioscript 3.0 docs say this- Note: Children instances placed on the Stage in the Flash authoring tool cannot be accessed by code from within the constructor of a parent instance since they have not been created at that point in code execution. Before accessing the child, the parent must instead either create the child instance by code or delay access to a callback function that listens for the child to dispatch itsĀ Event.ADDED_TO_STAGEĀ event.
So I mean, really I get why what I'm trying to do would cause an error, but I still don't get how to work around it.
Anyone who actually read this far into my gibberish, thank you. You are a kind and patient soul, haha. This issue is really consuming me so any attempt to help me understand the theory of how this works would be IMMENSELY appreciated. :D
...From what I understood after an all nighter (and sorry if this isn't the answer you're looking for)
You need to link Scene (the object in your library in Adobe Flash (or Adobe Animate if you're using that)) to your class. (Export for Actionscript) BUT (and here's the kicker) you need to also check export for frame 1 and make sure it's loaded on frame 1.
I run into issues like this when I'm not paying attention. Make sure the movieclip nested inside your main movieclip, somehow, gets loaded. Be it through the constructor, or on frame 1. Say your nested movieclip is on frame 2. Well, flash hasn't loaded frame 2. Therefor, it hasn't constructed anything inside frame 2. So it has no idea what you're talking about.
At times, i've had to do a gotoAndStop(2) and then right back to 1 just so that an object on frame 2 was named and ready to be handled in the future.

How do I add trusted code to a plone 4.x product that can be used by or as a workflow transition script?

I am trying to construct a workflow that can be assigned to arbitrary containers and will have the following behavior. When the container makes the transition from state A -> A', the contents of the container should be checked for their state and moved to a new state that depends on their present state. In other words:
obj1: in state 'a' would be transitioned to 'a*'
obj2: in state 'b' would be transitioned to 'b*'
and so on...
obj1 and obj2 are following the same workflow that branches to a number of final states (approved, denied, alternate, etc...)
I know how to do this, if I can trigger my python code as trusted code. Unfortunately, I have not been able to figure out how or where to put the code in my product so this will work. I have found references to using "external methods", however that seems to be going away. Also I want the code to reside in my project.
I think this is probably simple and I am overlooking something. Help with how to put this in my project or another route to achieving the same goal would be welcome.
The scripts support for DCWorkflow only supports through-the-web-addable objects, which limits you to External Methods there.
A better bet is to use workflow events instead. For each workflow transition, two events are fired:
Products.DCWorkflow.interfaces.IAfterTransitionEvent
Products.DCWorkflow.interfaces.IBeforeTransitionEvent
If you subscribe to either of those events, you can then filter on the correct workflow and transistion to react to transitions from trusted code.
Each event fired has the following attributes:
object: the workflowed object
workflow: the current applicable workflow object
old_state: a Products.DCWorkflow.States.StateDefinition object
new_state: another Products.DCWorkflow.States.StateDefinition object
transition: a Products.DCWorkflow.Transititions.TransitionDefinition object
status: a dictionary with the current workflow variables
kwargs: a dictionary of extra arguments passed in to the change-transition call.
Register a subscriber using ZCML:
<subscriber
provides="zope.component.testfiles.adapter.IS"
factory=".youreventsmodule.aftertransition_handler"
for="Products.DCWorkflow.interfaces.IAfterTransitionEvent"
/>
or, because the transition events are object events, listen only to the transition event if it applies to your objects:
<subscriber
provides="zope.component.testfiles.adapter.IS"
factory=".youreventsmodule.container_aftertransition_handler"
for=".interfaces.IMyContainerType
Products.DCWorkflow.interfaces.IAfterTransitionEvent"
/>
which registers your handler only for transition events on objects with the IMyContainerType interface only.
The handler would be:
def aftertransition_handler(event):
# handle all transition events, ever
or, when limiting it to one object interface:
def aftertransition_handler(obj, event):
# handle all transition events for our container interface