Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > CopperCube Open discussion
control behavior params by another script

hadoken
Guest
Quote
2021-03-04 10:35:00

Does anyone know, if the parameter values of a behavior script (shown in the editor) can be read and changed by another behavior script?

Thanks for any thoughts on this.


just_in_case
Moderator
Quote
2021-03-04 12:56:22

If you are talking about custom behaviors then yes, you can change the values by modifying those scripts to set coppercube variables and in other behavior you can get the values or vice versa. this can also be done with actions.
but there is no way you can edit the inbuilt behaviors or actions.
hope that answers to your question.


hadoken
Guest
Quote
2021-03-04 13:58:25

@just_in_case, thank you

I might be out of luck then, 'cause I was referring to change built-in behavior parameters by an additionally custom script of mine

so at this point we seem to have a solid cc limitation ;-(


smnmhmdy
Registered User
Quote
2021-03-05 10:02:47

@just_in_case There is an easier way of doing it too, just declare a global variable at the start of your behavior file and set its value to "this" inside of your constructor
var _ScriptA;
behavior_scriptA = function(){
_ScriptA = this;
this.Position = new vector3d(0,10,0);
}

Then you can reference that entire script's (this.) variables by simply calling it's name from a different script:
var _ScriptA;
behavior_scriptB = function() { print(_ScriptA.Position); // prints (0,10,0)}



just_in_case
Moderator
Quote
2021-03-05 11:15:08

@smnmhmdy I am aware about that. and have already mentioned same thing a few time on my discord and here on the forums as well. I am aware about global variables and how to define them. But the thing is all about Altering values of inbuilt behaviors or actions.

There can be many ways of achieving same task. and this one according to me is a lil bit tedious. most of the people don't prefer writing JavaScript again and again. they prefer to use the actions to change variables.

So assigning a CopperCube variable once in a behavior will allow the user to change it in the editor itself. by using the action. So this will be much easier for user who don't know coding.

I don't know if one can change this.variable using coppercube's inbuilt action set or change a variable.

Only a few global variables are known to us, like hashtag.Player.movemenstspeed ,player.health and all.

btw thanks for sharing your skills. Your skills are superior to many of us. I posted your shared behavior of animate texture coordinates to my Discord server. If you allow me I will like to share them on my website as well.

https://neophyte.cf

You can also join my Discord server here if you like to:

https://dicord.gg/RKcq89S7uA

Really impressed with your A* algorithm. I wish if my coding skills were such great but am still a learner.





smnmhmdy
Registered User
Quote
2021-03-05 15:48:21

@just_in_case Yeah, I've recently discovered that and I thought it might be useful to share, but you already knew about it
And of course, feel free to share them on your website, I'll make sure to join your discord server too, seems like a really good place to learn a thing or two


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Interna?ional" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact