Refering to variable names

BlitzPlus Forums/BlitzPlus Programming/Refering to variable names

Mordax_Praetorian(Posted 2005) [#1]
I'm attempting to create a function to modify image variables, and need to specify the image variable when calling the function

How do I make a function so that I can call it with the name of a variable and then have the function alter it?


Beaker(Posted 2005) [#2]
myImage = LoadImage("myImage.png")
myFunction(myImage)

Function myFunction(anyImage)
	;MaskImage anyImage,255,0,0 ;example
End Function



Mordax_Praetorian(Posted 2005) [#3]
gotcha

thx


Mordax_Praetorian(Posted 2005) [#4]
on a related note I made this program to test a function specificly for changing the colours of pictures:
Graphics 800,600
Cheese = LoadImage ("Images/Cursor.png")
DrawImage Cheese, 0, 0
Flip
Delay 5000
Cheese = ColourSub(Cheese,32,0,128,200,140,0)
Cls
DrawImage Cheese, 0, 0
Flip
Delay 5000

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
	Return Image
	ClsColor 0,0,0
End Function


however after 5 seconds when the colour on the picture changes the background clears to the new colour, this deffinitly shouldnt happen as I change the ClsColor at the end of the function

Edit: Argh! I put the Cls Colour after the return command, I'm so stupid


aab(Posted 2005) [#5]
i done something just like that 'bout 10 mins ago!