About Monkey 2 › Forums › Monkey 2 Programming Help › lots of errors in both important tutorials
This topic contains 17 replies, has 8 voices, and was last updated by 
 medi
 1 year, 9 months ago.
- 
		AuthorPosts
 - 
		
			
				
July 7, 2017 at 9:55 pm #9171
I get error in all parts of Spacecraft Tutorial (13 parts) except the first part. I also get error in many examples in Monkey2 Examples at Github.
I used Monkey2-v1.1.05 in Windows 8.1.
There is no tutorial for using file io, which is very important. The Spacecraft shows the way to work with json, but codes do not compile. Many import parts of the help and documentation are empty.
I randomly picked some games from banana and found that all compile and run well. But learning from samples is not the right way. I learned BlitzMAX from two important tutorials: 1 – Object-Oriented Programming in BlitzMAX, Judnich, 2 – Begining Guide to BlitzMAX, Wave.
July 8, 2017 at 7:38 am #9178Hi,
Which tutorial are you talking about? Can you post a link?
These cover a lot of ground: http://monkeycoder.co.nz/forums/topic/monkey-2-examples-github/Are you sure your installation is working properly? What are the errors you’re getting? I can compile the examples without issues here.
July 8, 2017 at 1:13 pm #9187Hi Ethernaut,
I used the binary version of Monkey2-v1.1.05.
Picking two examples: CivClone01 and Beginners – Proceed, I get this error:
***** Fatal mx2cc error *****
Internal mx2cc build errorAbout this:
https://github.com/peterigz/Monkey2Tutorials
My bad, I should install the two modules. However, since my intention was to test menkey2’s core, I totally ignored the fact that that tutorial need related modules being installed.
What else is needed to be done, after binary installation, to make “Beginners – Proceed” to work?
July 8, 2017 at 2:51 pm #9188I should update the readme and mention about installing the requisite modules. I still plan to do you tube vids of that tutorial I’m just finishing a lot of daytime work at the moment.
July 8, 2017 at 5:50 pm #9189@peterigz, I appreciate your work on providing the SpeceCraft tutorial. The monkey2-exmples-github is a great idea, but I need to examine the core parts, especially: io, json, xml. I just tried to avoid Java. I will take a look at Python on Sunday. I think it is better for me to be back for Monkey2 around Christmas time; Monkey2 train is still faster than the passengers
July 8, 2017 at 9:23 pm #9191I noticed that the latest monkey2 release introduced a new error. This is when you use methods in a class and using no class variables(I think) It needs you to change the reported methods to functions. This was with the civ clone. But on the 1.1.05 it should work. Internal error maybe means the compiler is not set up right?
July 9, 2017 at 10:52 pm #9205This is when you use methods in a class and using no class variables(I think) It needs you to change the reported methods to functions.
Can you post an example of this?
July 9, 2017 at 11:40 pm #9207The error message was : “Attempt to invoke method on null instance”
It gets triggered when the game is run, not catched while compiling.
I am uncommenting more and more of the code to trap the error. Could take a while.
July 9, 2017 at 11:46 pm #9209> “Attempt to invoke method on null instance”
Ah yes, this is new to 1.1.05. It used to be you could invoke a (non-virtual) method on a ‘null’ object, but this is now caught by the debugger at runtime, eg:
Monkey1234567891011Class CMethod Test()Print "Here!"EndEndFunction Main()Local c:C=Nullc.Test()EndThis *used* to be allowed in monkey2, but in 1.1.05 and later you will get the above error.
The debugger *should* show you where it’s happening?
July 10, 2017 at 12:04 am #9211I have this code here that works in the previous monkey2 version and not with the latest.
edit : aww just posted when I saw the new reply:)
edit: It does show where the error was triggered. But I had a hard time figuring out what the message ment at first:)
Monkey123456789101112131415161718192021222324252627282930313233#Import "<std>"#Import "<mojo>"Using std..Using mojo..'' Controls like mouse pressed and keyboardClass controlsMethod fortifyunit()End MethodEnd Class'Global mycontrols:controlsClass MyWindow Extends WindowMethod New()End MethodMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender() ' Activate this method'mycontrols.fortifyunit()End MethodEnd Class''Function Main()New AppInstanceNew MyWindowApp.Run()End FunctionJuly 12, 2017 at 4:17 pm #9279I am back. Python not good. Dynamically typed languages not good for me. I am going to try Monkey2 for a while.
July 13, 2017 at 7:54 am #9290I never understood the value in dynamic types. Seems that it is unproductive to save a few seconds of typing int, float, etc.. when the result is hours of debugging headaches when you type myNum = 3 instead of myNum = 3.0
As for null objects, it makes sense that you should create an instance with new controls before calling fortifyunit() method. Without an instance, there is no fortifyunit() to call, only a definition.
July 13, 2017 at 10:21 am #9292Oh, I think I understand now. I must have forgotten to use the New command. I now know that null objects mean with TomToads explanation
The code above now works when I added the New part behind the global.
July 13, 2017 at 1:51 pm #9297Ah yes, this is new to 1.1.05. It used to be you could invoke a (non-virtual) method on a ‘null’ object, but this is now caught by the debugger at runtime, eg:
I’m really happy to see this change, beacuse I understood -1 of the old debugger behaviour.
In debug mode, I’m now shown the origin of the null error GREAT, but in release mode I still see the “Here!” printed to the console.
Surely that can’t be correct: – I’m expecting the app to crash before that… ?
July 13, 2017 at 4:09 pm #9298I cannot find any reference to conditional expressions in docs. Is it hidden somewhere in there?
 - 
		AuthorPosts
 
You must be logged in to reply to this topic.