Functions modifying variables they shouldnt

BlitzPlus Forums/BlitzPlus Programming/Functions modifying variables they shouldnt

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm trying to make a function that will highlight an item on-screen when the player walks near it

To do this I'm altering the image for the item, putting it in a different variable and swapping between them at the apropriate time

Flamberge\ImageClose = ShowTile (Flamberge\Image)


This function however seems to modify the original Flamberge\Image before putting it in the new variable

The function itself looks like this, and uses a function I did earier that I'll also paste at the bottom:


Function ShowTile (tile,save=0)
	If Save = 1
		Flip False
	EndIf
	tile = ColourSub(tile,0,0,0,0,255,255)
	If Save = 1
		Flip False
	EndIf
	Return tile
End Function


Function ColourSub(Image,OldR,OldG,OldB,NewR,NewG,NewB)
	MaskImage Image, OldR,OldG,OldB
	ClsColor NewR,NewG,NewB
	Cls
	DrawImage Image, 0, 0
	GrabImage Image, 0,0
	ClsColor 0,0,0
	Return Image
End Function


Update: Putting the image into a new variable inside the function has no affect, and skipping the top function and just using the ColourSub function directly also seems to have no affect

I'm quite sure that functions usualy dont affect variables being passed to them unless being returned to the same variable