<hit type="script">
rundelegate (this, "attack", 4)
</hit>
<kick type="script">
rundelegate (this, "attack", 7)
</kick> <hit type="script">
rundelegate (this, "attack", GetRandomInt(1,4))
</hit>
<kick type="script">
rundelegate (this, "attack", GetRandomInt(5,8))
</kick>SHOULD this be done (by which I mean, is using delegates the best way to accomplish this at all)?
jaynabonne wrote:What I'm struggling with is whether you're just trying to make sense of the wiki or whether you have an application in mind and want to morph the wiki into that.
Also, your topic is about a delegate that *returns* a range of numbers, but your specific question doesn't seem to be about that as such.
"Should" is up to you.
It's straightforward to incrementally modify the existing code in the way you described (so the "can" answer is "yes".) Whether you want to or not...
Jay wrote:Rather than try to encapsulate all in one script ("if type is elf, do this; if type is spider, do that;" etc, which would cause most programmers to want to upchuck), you say "each object will have a doattack script attribute that I will call." It encapsulates the behavior in the object itself.