Jump to content

CastorGui: Passing object properties or global variables


dbawel
 Share

Recommended Posts

I have a portion of my GUI created using the CastorGui extension. I've been trying to pass an object property from the colorSelector.getColor(); (r,g,b) values to another script (my main BJS script), as I have to keep the extension calls and functions in a seperate script. As a quick fix, I also tried to pass a global variable holding the parseFloat() (r.g.b) values, but I haven't had any luck passing these values using either method. What is the best method to pass these values - as well as to pass a CASTORGUI.GUISlider() value to a seperate script to use as a video slider control. I will also need to pass values back to my CasterGui script as well.

Thanks for your help,

DB

Link to comment
Share on other sites

Hi @Dad72,

I replied to your post 2 days ago, but as happens on rare occasions, the post never went onto the forum for you to read. However, since then I discovered what appeared to be causing the problem, but have no idea why. I also wrote to let you know that I have read all of the documentation for CastorGUI, as well as thoroughly studying the extension itself. But what I just discovered is information I didn't have last I read through the extension script - so perhaps the answer is there.

So as I was writing this post to report an unusual behavior I discovered, I came upon the issue where suddenly the reverse of the circumstance causing the problem began to show different results. I try not to post anything unless I'm certain I have my facts correct. However, just as I was completing the post to report unusual behavior between scripts when calling the CastorGUI extension, suddenly what was not working began to work - and what was working, did not work any longer - with no changes to the scripts, server, or browsers.

So as to not loose other work, I had to save all my files, and I will reboot, and clean up browser cache, history, cookies, etc., and check to see what the heck the scripts are actually doing now. If I learn anything consistant  (which I tested this issue many, many times and received the same result, until I had written the post) - I will post my findings back to you. However, at this point, the behavior is so very odd to simply change behaviors with absolutely no input from me - is completely baffling. But I will continue and let you know what I find. Please wish me luck as I'm simply learning less and less info concerning the substantial issue I have with passing property values and global varables between scripts.

I'll let you know if I find anything, or else I'll possibly loose my mind (or maybe that is already the problem.)

Cheers,

DB

Link to comment
Share on other sites

@Dad72

I knew there was not a problem occuring in your extension, but I have discovered that if I often make and test changes in the Chrome browser, odd behaviors begin to occur such as global variables not passing values. Even launching a new Chrome browser doesn't always start clean and often intermitent behaviors remain when many changes have been made and tested on my system. I hadn't set any global variables previously in my script, so I didn't know what the heck the problem was - but once I discovered that global variables weren't being passed between scripts and I couldn't find the problem, it required a re-start of my OS to release whatever memory or cache issue (I believe) was causing the problem. I've run into issues using Chrome before, and launching a new browser would usually fix an inexplainable problem, but I've never had to re-start to correct any unknown issue before.

So FYI to anyone else who might have problems with their scene when it should obviously work as expected, as launching a new browser and/or re-starting would have saved me a whole lot of time on several occasions. We're all still working in reasonably new territory, and a re-start is a whole lot faster to rule out memory and/or browser issues than the hours that are often spent debugging a non-problem when you intuitively know something should be working.:unsure:

DB

Link to comment
Share on other sites

What I did for the global variables. I create one that contains all other global variable.

var global = {scene: null, engine: null, camera: null };

This way when you have a large number of global variable to use, it becomes more manageable and I think it's better memory level.

For your browser restart problem, he should empty its cache too. or do not cache with this:

<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE" />

 

Link to comment
Share on other sites

  • 2 weeks later...

@Dad72

Quote

var global = {scene: null, engine: null, camera: null };

This way when you have a large number of global variable to use, it becomes more manageable and I think it's better memory level.

For your browser restart problem, he should empty its cache too. or do not cache with this:


<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE" />

 

Since this post, I've been using this method to declare global variables (which I try to impliment as little as possible) - and it has definately improved performance (far less restarts) within my applications and OS as I've observed measurably fewer errors within various browsers from what appear to be memory or cache problems.

Again, thank you for your guidance.

DB

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...