Cannot call method 'SetColor' of Null?

Monkey Forums/Monkey Programming/Cannot call method 'SetColor' of Null?

GfK(Posted 2012) [#1]
Trying to recompile some code which was originally written in Monkey v45.

It compiles (HTML5), and my "loading" screen displays, then I get the above error.

Taking it literally I would assume it to mean there is no graphics object present..... but why would that be? Tried HiToro's "basicgame" sample and threw in a SetColor to test, and that worked fine.

(testing with Monkey v66).


Amon(Posted 2012) [#2]
Did you delete the Build folder? Sorry if you've already done that but that usually is what causes 80% of the problems.


GfK(Posted 2012) [#3]
Yeah, already did that.

About to try GLFW target, see if it's just HTML5 playing silly buggers.


GfK(Posted 2012) [#4]
A new error with GLFW after installing VS2012:
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V110Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.


Great... only I don't have a "project menu". WTF?

[edit] For some reason the slashes are being stripped from the file path when I paste it here.


GfK(Posted 2012) [#5]
Right, so I have to go into my .build folder, open the project in VS2012, THEN go to the project menu, but all that does is let me update the project to work with VS2012. Apparently there is no backwards-compatibility and I now have to get rid of VS2012, and track down a copy of VS2010.

FFS... :/


Amon(Posted 2012) [#6]
in your Monkey bin folder is the config.winnt.txt set up properly?

Here's what my config.winnt.txt which shows where MSBuild is!

Oh! Are you on Mac or Windows?

'MSBUILD path.
'
'Must be set for XNA and GLFW target support.
'
'Visual C++ 2010 Express is required for GLFW target support and is currently available here:
'	http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express
'
'Visual C# 2010 Express and XNA 4.0 are requred for XNA target support and are currently available here:
'	http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express
'	http://www.microsoft.com/download/en/details.aspx?id=23714
'
MSBUILD_PATH="${WINDIR}Microsoft.NETFrameworkv4.0.30319MSBuild.exe"
'--------------------


Much like you I ask, why is the forum stripping out the "/"?


GfK(Posted 2012) [#7]
Yeah the path is correct.

I clicked that link above, which redirects me to VS2012 (which is why I downloaded it). I'm now downloading Visual C++ Express 2010 which I had to hunt a bit for, from that page.

Probably isn't going to solve the original problem, though!


GfK(Posted 2012) [#8]
Well, eventually got it to compile and run on my iPad, and I'm still getting errors about SetColor:

bb_graphics_renderDevice->SetColor(t_r,t_g,t_b); <<Thread 1:EXC_BAD_ACCESS (code=1, address=0x0)

Seems that there is no render device. But since you don't have to manually create a graphics object (BMax Speak) in Monkey, how is that even possible??

Ideas?


Amon(Posted 2012) [#9]
Forgot to say; you can use MinGW to build glfw. Set at top of your code #GLFW_USE_MINGW=true

You'll need MinGW installed. The one that works perfect with Monkey is located here: http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm-gcc-4.7.1-2.exe/download

Also make sure in your config.winnt.txt file you set it up to point to MinGW location.

Again, soz if you have already done this!


GfK(Posted 2012) [#10]
Found the problem - had a couple of rogue SetColors in my Update method. They were there before, but it seems they don't silently fail any more. The same goes for SetAlpha.


John McCubbin(Posted 2012) [#11]
Ah right I was about to suggest you check anything called in the OnUpdate() method and double check there were no graphic commands there, as it's quite strict now.