Player Swapping?

Started by Hotshot, June 19, 2021, 12:37:11

Previous topic - Next topic

Hotshot


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!


Derron

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

Midimaster

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.
...on the way to Egypt

col

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.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."