About Monkey 2 › Forums › Monkey 2 Programming Help › Mod Help
This topic contains 9 replies, has 4 voices, and was last updated by
Gwenel
1 week, 3 days ago.
-
AuthorPosts
-
March 10, 2019 at 11:16 pm #16117
Any one know why i cant make this work as a module? just keeps saying cant find base interface
Click To Expand CodeMonkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576Namespace BaseInterface#Import "<std>"#Import "<win32>"#Import "<reflection>"Using std..Using win32..Using reflection..'//Interface IActorMethod Actor()End Interface'//Interface IPropMethod Prop()End Interface'//Interface IWardrobeMethod Wardrobe()End Interface'//Interface ISceneMethod Scene()End Interface'//Interface IAbilityMethod Ability()End Interface'//Interface IEffectMethod Effect()End Interface'//Interface ISoundMethod Sound()End Interface'//Interface IMusicMethod Music()End Interface'//Interface IComponentMethod Enabled()Method SetEnabled()End Interface'//Interface IServiceProviderMethod RemoveService()Method GetService()End Interface'//Interface ISystemMethod Initialize()Method UpdateFirst()Method UpdateLast()Method Draw()Method Shutdown()End Interface'//Interface IFireButtonMethod IsFireDown()Method IsFireHit()End Interface'//Interface IControllerMethod MoveUp()Method MoveDown()Method MoveLeft()Method MoveRight()Method AddFire()Method Fire()Method ButtonCount()End Interface'//Interface IObserverMethod OnNotify(actor:Object, event:Object)Endi have it in a folder called oak and a json file like so.
Monkey12345678{"module":"baseinterface","about":"Interface Collection","author":"Damian Yarker","version":"1.0.0","support":"none","depends":["std"]}I just want to put a few interfaces into one file so i can just include it in all my projects.
March 11, 2019 at 12:30 am #16118The folder should be “/modules/baseinterface” and the filename “baseinterface.monkey2” if you want to #Import “<baseinterface>”.
March 11, 2019 at 1:38 am #16119Ah cool thanks.
March 11, 2019 at 1:43 am #16120Also how easy is it to port monkey code to m2? as i notice a book on monkey that might be easy enough to use if it easly portable.
March 11, 2019 at 7:12 am #16121Just my personal opinion: I don’t think a Monkey-X book is of any help with Monkey2.
The modules are completely different, in my opinion.
March 11, 2019 at 12:10 pm #16122One more thing lol
Is there any way to interact with serial/com ports? I have a aduino robot and i wanted to read in from the Sensor to make an old school sonar effect(think das boat) I dont need to wright to my aduino as thats all done in c, I just need to read in the data so i can plot the senser data.
March 11, 2019 at 2:27 pm #16123I suppose you have to read tru your arduino drivers? There is no specific serial port thing in monkey2 AFAIK. But everything that can be donne in C can be imported into Monkey2 (c++ might need some glue/wrapping).
If you want some help in calling arduino with monkey2. I’ll be glad to help as I always wanted to play with an arduino. I don’t own one though, but I want to own one anyway.
If you show some C code that works I probably can help.March 11, 2019 at 2:45 pm #16124https://www.ottodiy.com/ its him!
https://github.com/OttoDIY all the code is there it easy cheap and a damn robot! lol
now you comunicate using com/serial all i need is code to open the port and to grab the out put data and convert to usable m2.
BlitzMax has bah.serial so i might check that as if it works in BM should be able to import the c/c++ code.
March 12, 2019 at 3:52 pm #16126I can see some cross platform serial libraries so it should be doable. But the bmx serial package could be event better!?
https://github.com/wjwwood/serial
https://sigrok.org/api/libserialport/unstable/index.html
March 12, 2019 at 4:49 pm #16127Another way might be to use the web platform, then you might use Chrome’s API to access the Serial port.
https://developer.chrome.com/apps/serial
-
AuthorPosts
You must be logged in to reply to this topic.