Functions keep throwing find overload errors?

Monkey Forums/Monkey Beginners/Functions keep throwing find overload errors?

Finalfantasiser(Posted 2016) [#1]
Hey all, first time posting here - been using monkey for a week now and have a little exp in coding.
I have a few smaller functioning Functions but when I'm trying to make larger functions I keep getting overload errors. It's probably a small stupid error or something, but I can't for the life of me figure it out :/

Function Write_Log:Void(Frame_Count, Player_Coord, Mouse_Coord, Screen_Width, Screen_Height)

	Local Frame_String$
	Local Player_String$
	Local Settings_String$
	Local Mouse_String$
	Local Write_Settings$
	Local Write_Frame_Log$
	Local Player_Name$ = "Player"
	Local Loaded_Log_File$
	Local Appended_Log$
	
	Frame_String = "[" + Frame_Count + "]: "
	Player_String = "Player: " + Player_Name + " " + Player_Coord
	Settings_String = "Resolution: " + Screen_Width + "x" + Screen_Height
	Mouse_String = "Mouse Location: " + Mouse_Coord
	
	Write_Settings = "Game Loaded - Settings: " + Settings_String + "~r~n"
	Write_Frame_Log = Frame_String + Player_String + "~r~n" + Frame_String + Mouse_String + "~r~n"

	If New_Game = 0
		SaveString (Write_Settings,"Log_File.txt")
		New_Game = 1
	End	
	Loaded_Log_File = LoadString ("Log_File.txt")
	Appended_Log = Loaded_Log_File + Write_Frame_Log
	SaveString (Appended_Log,"Log_File.txt")
	
	Return
End


This bit of code for example - if I remove it from the function, and just run it raw inside the OnUpdate Method it works fine.

However running it with
Write_Log(Frame_Count, Player_Coord, Mouse_Coord, Screen_Width, Screen_Height)


Gives the error:
---------------------------
Compile Error
---------------------------
Unable to find overload for Write_Log(Int,String,String,Float,Float).
---------------------------
OK
---------------------------

As I say, I have a few functions this is happening too.

Many thanks in advance!
Final.


therevills(Posted 2016) [#2]
Check your variable types you are passing to your functions, by the looks at the error message:
Frame_count is an int
Player_Coord is a String
Mouse_Coord is a String
Screen_Width is a float
Screen_Height is a float


Because you are not using "Strict" all your parameter variables are ints by default.
Strict
Function Write_Log:Void(Frame_Count:Int, Player_Coord:Int, Mouse_Coord:Int, Screen_Width:Int, Screen_Height:Int)



Finalfantasiser(Posted 2016) [#3]
Oh wow! Many thanks, worked flawlessly! I'll start using strict from now on :D