Scripts Talk:Slice arrays

From OHRRPGCE-Wiki
Jump to navigation Jump to search

getArray is missing a return Sword (talk) 10:43, 9 October 2018 (PDT)

How about an argument to initArray that prevents duplicate copies? by lookup perhaps

SUGGESTED SCRIPTS

   plotscript, hero array, hero=0,size=0, lookup=0, fill=0,, begin
   reparent to hero(init array(size,lookup,fill),hero)
   end
   script, search hero array, hero, lookup, begin
   return(lookupSlice(lookup, lookup slice(sl:walkabout sprite component, get hero slice(hero))))
   end
   script, npc array, npc=0, size=0, lookup=0, fill=0, begin
   reparent to npc(init array(size,lookup,fill),npc)
   end
   script, search npc array, npc, lookup, begin
   return(lookupSlice(lookup,lookup slice(sl:walkabout sprite component, get npc slice(npc))))
   end
   script, parent array, parent=0, size=0, lookup=0, fill=0, begin
   set parent(init array(size,lookup,fill),parent)
   end
   script, search slice array, slice, lookup, begin
   return(lookupSlice(lookup, slice))
   end
   script, swap, ao, at, begin
   # it doesn't swap the lookups. maybe it should as an option
   variable(cpy)
   cpy:=sub array(ao,1,-1)
   clear(ao)
   concat(ao, at)
   clear(at)
   concat(at,cpy)
   free slice(cpy)
   end