Browse Source

Slightly nicer debug output

master
Ben Kurtovic 13 years ago
parent
commit
42269dc718
4 changed files with 8 additions and 7 deletions
  1. +3
    -1
      base.nls
  2. +0
    -1
      explosion.nls
  3. +2
    -2
      lobo.nlogo
  4. +3
    -3
      tank.nls

+ 3
- 1
base.nls View File

@@ -62,6 +62,7 @@ to do-base-logic
end end


to claim-base [claimer] to claim-base [claimer]
debug who "BASE-CLAIM" (word "by " ([who] of claimer) ": " team " -> " [team] of claimer)
set team [team] of claimer set team [team] of claimer
set color get-base-color set color get-base-color
end end
@@ -107,12 +108,13 @@ to regenerate
end end


to base-shot-at to base-shot-at
debug "BASE-SHOT" (word who " by " ([shooter] of myself))
set armor armor - 1 set armor armor - 1
ifelse armor > 0 [ ifelse armor > 0 [
debug who "BASE-SHOT" (word "by " ([shooter] of myself))
explode "decay" explode "decay"
play-sound "shot" play-sound "shot"
] [ ] [
debug who "BASE-KILL" (word "by " ([shooter] of myself))
explode "shot" explode "shot"
play-sound "kill" play-sound "kill"
] ]


+ 0
- 1
explosion.nls View File

@@ -31,7 +31,6 @@ to make-explosions-table
end end


to explode [name] to explode [name]
debug "EXPLODE" name
let data table:get explodes name let data table:get explodes name
foreach data [ foreach data [
create-explosion ? create-explosion ?


+ 2
- 2
lobo.nlogo View File

@@ -82,10 +82,10 @@ end
;; Other procedures ;; Other procedures
;; ================ ;; ================


to debug [action msg]
to debug [agent action msg]
; Comment this and remove the output box ; Comment this and remove the output box
; to turn off debugging info: ; to turn off debugging info:
output-print (word (round timer) ": " action ": " msg)
output-print (word (round timer) ": " agent ": " action " (" msg ")")
end end


to setup-defaults to setup-defaults


+ 3
- 3
tank.nls View File

@@ -95,7 +95,7 @@ end
to fire to fire
if fire-cool-down = 0 [ if fire-cool-down = 0 [
ifelse ammunition > 0 [ ifelse ammunition > 0 [
debug "FIRE" (word who " (" ammunition " left)")
debug who "TANK-FIRE" (word ammunition " left")
set ammunition ammunition - 1 set ammunition ammunition - 1
fire-bullet fire-bullet
play-sound "fire" play-sound "fire"
@@ -107,7 +107,7 @@ to fire
end end


to tank-shot-at to tank-shot-at
debug "SHOT" (word who " by " ([shooter] of myself))
debug who "TANK-SHOT" (word "by " ([shooter] of myself))
set armor armor - 1 set armor armor - 1
ifelse armor = 0 [ ifelse armor = 0 [
explode "kill" explode "kill"
@@ -120,7 +120,7 @@ to tank-shot-at
end end


to kill-tank to kill-tank
debug "KILL" (word who " by " ([shooter] of myself))
debug who "TANK-KILL" (word "by " ([shooter] of myself))
if is-player? [ if is-player? [
set player-deaths player-deaths + 1 set player-deaths player-deaths + 1
] ]


Loading…
Cancel
Save