Question: i am new on cocos2d, I have 

```
int score;//default 0

```

I am increasing the score but when switch scene, score is going to be 0 again.
How can i keep the score when i switch the scene?

Sorry for my bad english.

Best Regards. Thanks for your advice.

Answer: 
I reset `lawlist-filename` to `nil` at the end of each example so that it can be used in a variety of other functions, including, but not limited to, `dired-read-file-name`: [dired-read-file-name: pop-up dired mode to read-file-name](https://stackoverflow.com/questions/19899595/dired-read-file-name-pop-up-dired-mode-to-read-file-name)

EDIT:  Rewritten with the help of @phils -- uses `let` bindings, instead of global variables.

```
(eval-after-load "dired" '(progn

  ;; open anything externally with OSX default app -- Wide-Open-Throttle!
  (define-key dired-mode-map (kbd "z") (lambda () (interactive)
    (let ((lawlist-filename (dired-get-file-for-visit)))
      (start-process "default-app" nil "open" lawlist-filename))))

  ;; open *.pdf file externally with the OSX default *.pdf viewer.
  (define-key dired-mode-map (kbd "<SPC>") (lambda () (interactive)
    (let ((lawlist-filename (dired-get-file-for-visit)))
      (if (equal (file-name-extension lawlist-filename) "pdf")
        (start-process "default-pdf-app" nil "open" lawlist-filename)))))

  ;; open *.pdf file externally using Skim.
  (define-key dired-mode-map (kbd "v") (lambda () (interactive)
    (let* (
      (lawlist-filename (dired-get-file-for-visit))
      (skim "/Applications/Skim.app/Contents/MacOS/Skim") )
      (if (equal (file-name-extension lawlist-filename) "pdf")
        (start-process "pdf-with-skim" nil "open" "-a" skim lawlist-filename)))))

))

```
This works, but it seems inelegant:

<http://www.emacswiki.org/emacs/KeyboardMacros>

I used a macro:

> 
> (fset 'my\_macro
> 
> 
> 

```
[?! ?o ?p ?e ?n ?  return])

```