Popup HUD - part 2 of 2

Popup HUD - part 2 of 2 preview image

1 collaborator

Army_coat_pix R. Wade Schuette (Author)

Tags

hud 

Tagged by R. Wade Schuette over 2 years ago

levelspace 

Tagged by R. Wade Schuette over 2 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.2 • Viewed 149 times • Downloaded 8 times • Run 0 times
Download the 'Popup HUD - part 2 of 2' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;; This is "callable-HUD.nlogo" and is one of a pair of models which are both required
;; This uses the LevelSpace ("ls") extension and will not run over the web. You must download it.
;; This needs to be put in the same directory as "HUD-enabled-model.nlogo"
;; These are filed in the Netlogo Modeling Commons as "Popup-HUD part 1 of 2" and "Popup-HUD part 2 of 2"
;;

globals [ is-update-ready?
   ;; version ;; slider, version of unique data set.  Start counting at 1
   dirty-bit ;; true or false, is an update actually required?
   prior-number prior-size prior-shape  ;; track to see if an update is required
   has-setup-run?
]

;; which version of settings is this?

to setup
  clear-all  ;; which does NOT clear the sliders!
  reset-ticks
  set has-setup-run? true

  ;; read the sliders
  set prior-number number-of-turtles
  set prior-size size-of-turtles
  set prior-shape shape-of-turtles

  set version 1
  set last-version-read 9
  set dirty-bit true

  set is-update-ready? false
  create-turtles 1 [ set heading 0 set size 3 set shape "turtle" ]
  set status "idle"
end 

to pause
  set auto-update? false
end 

to go
  if not is-boolean? has-setup-run? [ setup ]
  if  ( auto-update? = false)  [ print "The auto-update switch is off! Stopping." stop ]
  if needs-update [ request-update ]
  wait 0.25  ;; limit maximum rate of checking, in seconds
  tick
end 

to-report needs-update
  ;; don't ask for an update if nothing has changed
  ;; reads current sliders, compares to laast settings

  if not (( prior-number = number-of-turtles ) and
       ( prior-size = size-of-turtles ) and
       (  prior-shape = shape-of-turtles )   )
    [ set dirty-bit true
      set prior-number number-of-turtles
      set prior-size size-of-turtles
      set prior-shape shape-of-turtles

     ]
  report dirty-bit
end 

to document-update
  output-print (word "\n== version # " version "\nprepared at tick " ticks "\n")
  output-print (word "number-of-turtles: " number-of-turtles)
  output-print (word  "size-of-turtles: " size-of-turtles )
  output-type ( "shape-of-turtles: ")
  output-write (  shape-of-turtles)
  output-type "\n"
  output-print ( "waiting...")
end 

to request-update
  ;; sets flag to tell parent it's ok to read this now
    set  dirty-bit  true

    set version ( version + 1 )
    set is-update-ready? true
    if ( document-updates?) [ document-update]
    set status "ready"
end 

to mark-update-complete
  set dirty-bit false
  if ( document-updates?) [ output-print "completed." ]
end 


;Copyright(c) 2022 by R. Wade Schuette ( wade.schuette@gmail.com) Attribution 4.0 International (CC BY 4.0) You are free to:
;Share — copy and redistribute the material in any medium or format
;Adapt, remix, transform, and build upon the material for any purpose, even commercially.
;Under the following terms:
;Attribution — You must give appropriate credit and indicate if changes were made.
;You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
;No additional restrictions —
;You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
;No warranty is made of fitness for any purpose

There is only one version of this model, created over 2 years ago by R. Wade Schuette.

Attached files

File Type Description Last updated
Popup HUD - part 2 of 2.png preview Preview for 'Popup HUD - part 2 of 2' over 2 years ago, by R. Wade Schuette Download

This model does not have any ancestors.

This model does not have any descendants.