variable type in a function

Blitz3D Forums/Blitz3D Beginners Area/variable type in a function

is there a way that i could make a function like:
function operateitem(t.type)
for t.type = each type
t\x = 1
next
end function

??

the reason for this is that i need to operate a large amount of items using the same method, just different names, so rather than copying the code:

For number1.genericitem = Each genericitem
			Select number1\slot 
				Case 1
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)-159, (displayheight/2)-233, 160, 160) And MouseHit(1) Then number1\held = True
				Case 2
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)+1, (displayheight/2)-233, 160, 160) And MouseHit(1) Then number1\held = True
				Case 3
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)-159, (displayheight/2)-73, 160, 160) And MouseHit(1) Then number1\held = True
				Case 4
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)+1, (displayheight/2)-73, 160, 160) And MouseHit(1) Then number1\held = True
				Case 5
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)-159, (displayheight/2)+13, 160, 160) And MouseHit(1) Then number1\held = True
				Case 6
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)+1, (displayheight/2)+13, 160, 160) And MouseHit(1) Then number1\held = True
			End Select 
			If number1\held = True Then
				DrawImage number1\image, MouseX(), MouseY()
				If Not MouseDown(1) Then
					number1\held = False
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)-159, (displayheight/2)-233, 160, 160) Then number1\slot = 1
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)+1, (displayheight/2)-233, 160, 160) Then  number1\slot = 2
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)-159, (displayheight/2)-73, 160, 160) Then number1\slot = 3
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)+1, (displayheight/2)-73, 160, 160) Then number1\slot = 4
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)+1, (displayheight/2)-73, 160, 160) Then number1\slot = 5
					If RectsOverlap (MouseX(), MouseY(), 1, 1, (displaywidth/2)+1, (displayheight/2)+13, 160, 160) Then number1\slot = 6
				EndIf
			EndIf
		Next


a billion times and chopping the names out and replacing them, I could just say:

operateitems(number1.genericitem)
operateitems(number2.genericitem)
operateitems(number3.weapon)

etc.

NOTE: each type of different kinds (genericitem, weapon, etc.) share the fields used in the proposed function.

No, this isn't possible. You can't pass more than one type to a function. But I suspect there may be another way to make this nicer.

crap...

can i change the sub-type?

the idea of using id's just occured to me, this thread is null and

VOID