is there a way that i could make a function like:
??
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:
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.
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.