Paste #10810: Edit of P#10808 - Untitled Paste

Date: 2014/10/28 06:06:51 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


I have this list

      - flag npc 'Markets:vacant|vacant|vacant'



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% == 'vacant' { 
          - flag npc <npc.flag[Markets].as_list.insert[<player.name>].at[%nMarket%]>
          - foreach stop 
          } 
        } 

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|vacant|vacant|vacant


But instead I get this. It's inserting the values of the list as the name of a new flag!


  '1028':
    Flags:
      MARKETS:
      - 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%]>