SyntaxBomb - Indie Coders
Languages & Coding => Blitz2D, BlitzPlus, Blitz3D => Topic started by: Hotshot on June 19, 2021, 12:37:11
I am using Dim Arrays and if I selected the player number 1 and want to swap to Number 12.
How would I swap Arrays when I selected the mouse down?
I had good look at Help where the commands lists is and there is No Swap Commands!
for example
First 11 players
1 GK David Lee
2
.
.
.
.
.
.
.
.
.
.
12 GK James Heywood(Second goalkeeper got better skills)
So would you move the mouse down to 12 and select him to swap number 1 to make James to be number 1 Keeper!
I am not sure what you mean:
array/dim with x entries.
either change the objects (if possible)
or restructure to not have a dim "team" with the people assigned to it ... but have a
team array only containing ids of person.
Then it is only a matter of switching the numbers
the "team dim" is then just a lookup for you to know what person to retrieve from a "person dim".
bye
Ron
If this is only a array of strings or types you could do it with a third variable:
locPlayer$ = Player[12]
Player[12] = Player[1]
Player[1] = locPlayer
If you want more detailed information you need to send more code, that we can see, how you defined the array.
Quote... and there is No Swap Commands
As Midimaster suggests.
'Swap functions' usually involve a temporary:
Tmp = 1stElement
1stElement = 2ndElement
2ndElement = Tmp
It's very easy to do this in your own code.