About Monkey 2 › Forums › Monkey 2 Development › Missing Mod
This topic contains 6 replies, has 4 voices, and was last updated by
DaY 2 years ago.
Viewing 7 posts - 1 through 7 (of 7 total)
-
AuthorPosts
-
April 9, 2017 at 8:47 pm #7815
why is there not a Mod() function in the maths part? or am i missing some thing.
April 9, 2017 at 9:07 pm #7816is there another way to do this as below works in BMX
[/crayon]Monkey1234567[crayon-5cb9bc6824807606910503 inline="true" ]Function TrueMod:Float(p_Value:Float, p_Mod:Short)p_Value:Mod p_ModIf p_Value < 0 Then p_Value:+p_ModReturn p_ValueEnd FunctionApril 9, 2017 at 9:37 pm #7818Don’t you just write “Mod”?
Like: Print 5 Mod 4April 9, 2017 at 10:10 pm #7820[/crayon]Monkey123456789[crayon-5cb9bc682a4c2973003583 inline="true" ]Method ModVector:Float(value:Float, trueMod:Short)value Mod = trueModIf value < 0 Thenvalue = value + trueModEndifReturn valueEnd Methodgives me these errors
[/crayon]Monkey12345678910111213141516171819202122232425262728[crayon-5cb9bc682a4d0460942594 inline="true" ]Mx2cc version 1.1.04***** Building app 'C:/Monkey2-v1.1.04/bananas/Pong/Main.monkey2' *****Parsing...Semanting...Translating...Compiling...Build error: System command 'g++ -I"C:/Monkey2-v1.1.04/modules/" -I"C:/Monkey2-v1.1.04/modules/monkey/native" -I"C:/Monkey2-v1.1.04/bananas/Pong/" -std=c++11 -m32 -I"C:/Monkey2-v1.1.04/modules/freetype/freetype-2.6.3/include/" -I"C:/Monkey2-v1.1.04/modules/openal/openal-soft/include/" -I"C:/Monkey2-v1.1.04/modules/gles20/angle/include/" -I"C:/Monkey2-v1.1.04/modules/sdl2/SDL/include/" -c -o "C:/Monkey2-v1.1.04/bananas/Pong/Main.buildv1.1.04/windows_debug/build/_1src_2Main_0Vector.cpp.o" "C:/Monkey2-v1.1.04/bananas/Pong/Main.buildv1.1.04/windows_debug/src/Main_Vector.cpp"' failed.g++ -I"C:/Monkey2-v1.1.04/modules/" -I"C:/Monkey2-v1.1.04/modules/monkey/native" -I"C:/Monkey2-v1.1.04/bananas/Pong/" -std=c++11 -m32 -I"C:/Monkey2-v1.1.04/modules/freetype/freetype-2.6.3/include/" -I"C:/Monkey2-v1.1.04/modules/openal/openal-soft/include/" -I"C:/Monkey2-v1.1.04/modules/gles20/angle/include/" -I"C:/Monkey2-v1.1.04/modules/sdl2/SDL/include/" -c -o "C:/Monkey2-v1.1.04/bananas/Pong/Main.buildv1.1.04/windows_debug/build/_1src_2Main_0Vector.cpp.o" "C:/Monkey2-v1.1.04/bananas/Pong/Main.buildv1.1.04/windows_debug/src/Main_Vector.cpp"C:/Monkey2-v1.1.04/bananas/Pong/Main.buildv1.1.04/windows_debug/src/Main_Vector.cpp: In member function 'bbFloat t_Library_Vector::m_ModVector(bbFloat, bbShort)':C:/Monkey2-v1.1.04/bananas/Pong/Main.buildv1.1.04/windows_debug/src/Main_Vector.cpp:173:29: error: invalid operands of types 'bbFloat {aka float}' and 'bbFloat {aka float}' to binary 'operator%'l_value%=bbFloat(l_trueMod);^C:/Monkey2-v1.1.04/bananas/Pong/Main.buildv1.1.04/windows_debug/src/Main_Vector.cpp:173:29: error: in evaluation of 'operator%=(bbFloat {aka float}, bbFloat {aka float})'***** Fatal mx2cc error *****Internal mx2cc build errorApril 9, 2017 at 10:25 pm #7821It should work. it works like this:
[/crayon]Monkey12345678910111213[crayon-5cb9bc682f4c6035720604 inline="true" ]Function Main()Print ModVector(10,3)EndFunction ModVector:Float(value:Float, trueMod:Short)value = value Mod trueModIf value < 0 Thenvalue = value + trueModEndifReturn valueEnd FunctionYou should report it as a bug over at GitHub.
April 9, 2017 at 10:32 pm #7822Yes, translator bug!
‘blah=blah mod etc’ works, but ‘blah mod=etc’ doesn’t, possibly only when blah is non-int type. Will fix.
April 10, 2017 at 12:21 am #7831ah ok thought it was me being dumb lol
-
AuthorPosts
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.