-
I have this list
- - flag npc 'Markets:null|null|null'
+ - flag npc 'Markets:vacant|vacant|vacant'
-I'm looping through it using this
+I'm looping through it using this to put the player name in the first 'vacant' position in the array.
- define nMarket 0
- foreach <npc.flag[Markets].as_list> {
- define nMarket <math.as_int:%nMarket%+1>
- - if %value% == null {
+ - if %value% == 'vacant' {
- flag npc <npc.flag[Markets].as_list.insert[<player.name>].at[%nMarket%]>
- - execute as_op "rg addowner trade%nMarket% <player.name>"
- - announce "<player.name> has now purchased market plot %nMarket%."
- foreach stop
}
}
-Expecting the output in the saves.yml to be this
+Expecting the output in the saves.yml to be this as it should insert the name at position 1 on it's first loop
'1028':
Flags:
MARKETS:
- - luigi_vampa|null|null
+ - luigi_vampa|vacant|vacant|vacant
-But instead I get this
+But instead I get this. It's inserting the values of the list as the name of a new flag!
'1028':
Flags:
MARKETS:
- - null|null|null
- LI@LUIGI_VAMPA|NULL|NULL|NULL:
+ - vacant|vacant|vacant
+ LI@LUIGI_VAMPA|VACANT|VACANT|VACANT:
- 'true'
so I'm guessing the problem is this line but I can't figure it out.
- flag npc <npc.flag[Markets].as_list.insert[<player.name>].at[%nMarket%]>