Blog

  • USA State Names, Abbreviations, & “getStateFromAbbr” function For You

    * Edited 12/8/2003 – North and South Carolina’s were mispelled.

    <a href=”https://www.jessewarden.com/clark04/”>Finishing round 1</a> of 2 of a map application for <a href=”http://www.clark04.com/”>www.clark04.com</a>. After all the typing I did for this small & simple app, I figured the least I could do was add some text files and a useful function to the archives of Google and hope that someone can garner use from these.

    Read on for text files and code…

  • TRON 2.0: Green Hornets Light Cycle Level Insanely Diffucult

    That’s right, harder than the nut that busted Nutcracker’s jaw. If anyone has beat it, let me know so my confidence in my gaming ability is once again restored so as to try again. After beating all the other Single Player light cycle levels, and attempting this level for 2 weeks off and on, I’m beginning to wonder if I should just end it all…

    … if you say you beat it in 10 minutes, then whoop-puh-dee-frikin’-doo for you. Explain what technique to employ. So far, hugging the wall has gotten me to the 3rd wave, but that Turbo Curse gets me everytime once I enter the red zone for a breather… the comp is so suicidal.

  • MovieClip-esque’ Sprite Creation in Director

    I missed my attachMovie and removeMovieClip commands from Flash whilst in Director, and after not being satisfied with some of the sprite engines posted on <a href=”http://www.director-online.com/”>Director-online.com</a>, I built my own. It’s far from complete, as I added like no error checking, but it still works as long as you don’t screw up (like attach a sprite to the same depth, but that doesn’t work well in Flash either, now does it?)

    Like everything in Director, though, you need at least something on the stage to get this to work. It’s really simple, though.

    – open the bitmap window
    – give it a name “blank”
    – close the bitmap window. This should put it as a cast member in your case
    – add it to sprite channel 1
    – repeat the same keyframe for as many sprites as you think you’ll use (I did the max, 1000, cause I’m freaky-deaky like that)
    – add this code as a movie script (or with your other code)
    <pre><code>
    global gSprites

    on prepareMovie

    gSprites = [:]

    end

    on attachSprite memberName, spriteName, spriteDepth
    s = Symbol(spriteName)
    if voidP(gSprites[s]) then
    sprite(spriteDepth).member = member(memberName)
    sprite(spriteDepth).member.regPoint = point(0, 0)
    gSprites[s] = sprite(spriteDepth)
    return sprite(spriteDepth)
    end if
    end

    on removeSprite spriteName
    i = gSprites.getOne(spriteName)
    if voidP(i) = false then
    s = Symbol(spriteName)
    gSprites[s].member = member(“blank”)
    gSprites[s].locH = 0
    gSprites[s].locV = 0
    gSprites.deleteOne(gSprites[s])
    return true
    else
    return false
    end if
    end

    on gSprite spriteName
    return gSprites[Symbol(spriteName)]
    end
    </code></pre>

    Now, if you want to use it, just do:
    <pre><code>
    — attach
    mySprite = attachSprite(“MemberName”, “spriteString”, 1)
    mySprite.locH = 320
    mySprite.locV = 240
    — remove
    removeSprite(“spriteString”)
    </code></pre>

    And, instead of that sprite(5) bs, you can do:
    <pre><code>
    gSprites[#spriteString].locH = 5
    –or, if your not familiar with Symbols in Director
    gSprites[Symbol(“spriteString”)].locH = 5
    — or
    gSprite(“spriteString”).locH = 5
    </code></pre>

    :: extends chin ::
    Tasty beef!

  • EventBroadcaster for Director

    You have to implement via Decorator pattern (think that’s the one…) instead of using initialize, but so far, seems to work. The only issue is, I am still trying to figure out how to do Function.apply in Director… because currently, I’m just passing the parameters as an array to the call method; which was the point of Function.apply being able to have any number parameters passed as an array, and then doing the argument distribution for you. At any rate, here’s what I got:
    <pre><code>
    property pListeners

    on new me
    init()
    return me
    end

    on init me
    pListeners = []
    end

    on broadcastMessage me, msg
    howMany = pListeners.count()
    repeat with n = 1 to howMany
    o = pListeners[n]
    if o.handler(msg) = true then
    l = paramCount()
    a = []
    repeat with i = 2 to l
    a.append(param(i))
    end repeat
    call(Symbol(msg), o, a)
    end if
    end repeat

    end

    on addListener me, obj
    pListeners.append(obj)
    end

    on removeListener me, obj
    howMany = pListeners.count()
    repeat with n = 1 to howMany
    if pListeners[n] = obj then
    pListeners.deleteProp(n)
    return true
    end if
    end repeat
    return false
    end
    </code></pre>

    And you can implement in your Parent Scripts (or behaviors I guess) like so:
    <pre><code>
    property pBroadcaster

    on new me
    init()
    end

    on init me
    pBroadcaster = script(“EventBroadcaster”).new()
    end

    on addListener me, obj
    pBroadcaster.addListener(obj)
    end

    on removeListener me, obj
    success = pBroadcaster.removeListener(obj)
    return success
    end

    on broadcastMessage me, msg
    pBroadcaster.broadcastMessage(msg, param1, paramN)
    end
    </code></pre>

    …still, would be great to figure out how to pass dynamic amounts of parameters like you can in Flash using Function.apply…