top of script window
no picasso zone code snippet | show it | return |
on newColors
  -- generate a new set of 10 colors for drawing
  global gColors, gCurrColor
  set gColors = [] 
  repeat with i = 1 to 10    
    repeat while 1
      -- stay in loop until we get a unique color   
      put random (255) into newColor
      if getOne(gColors, newColor) = 0 then
        add gColors, newColor
        exit repeat
      end if
    end repeat
    
    -- set up the drawing sprite
    set the foreColor of sprite 34 + i = newColor
  end repeat 
  set the loc of sprite 34 = point(268,48)
  
  -- update current active color 
  set gCurrColor = the foreColor of sprite 35  
  updateStage
end

on makePal
  -- make a new set of colors
  newColors
  
  -- put them on screen in a 2 column, 5 row grid
  repeat with col = 0 to 1
    set hDot = 270 + col * 30
    repeat with row = 1 to 5
      set palNum = col * 5 + row
      set the loc of sprite (34 + palNum) to point(hDot, 50 + (row - 1) * 24)
      updateStage
    end repeat
  end repeat
end
The makePal handler is called to generate a new set of 10 different colors put on screen as drawing "chips", each a quickdraw circle shape. It calls newColors to generate a set of 10 unique colors from 0 to 255.

lingo era = v5 The colors are on screen in a fixed location, 5 rows with two colors each, so the placement in the makePal handler is hardwired.