I'm curious about how I would go about doing this, and I'm confident I could do it, just not really sure where to start so some theories or pushes in the right direction would be appreciated.
I was wondering rather than like pressing a "Run" button then pressing and holding the arrow keys to start running, it'd be much easier to just hold down the arrow key in one direction, build up speed and eventually switch to running, and if you change directions, you lose some speed, but not enough to stop the process. But halting all together for a few seconds would mean you have to do the process all over again..
Would I have to have a proc constantly draining like a RunningSpeed var, and using North(), East() etc. procs, build up a counter var to which the speed of running/moving could be determined, and by not moving one variable would gain dominance and switch it..
I'm not sure if I answered my own question or just further confused myself on the topic..x.x
ID:158270
![]() Sep 27 2009, 8:45 am
|
|
![]() Sep 27 2009, 3:15 pm
|
|
That was a brilliant example..I hadn't even thought to use world.time.. I feel utterly stupid because its probably the most logical thing to use.
But can I ask something, whats the difference between using .=..() and ..() Does it make a difference in ordinary code snippets? Or just ones like this this one? I understand, it saves a variable return, but honestly.. in the time I have been working with BYOND, I regret to say, returns was not one of my strong points. I've been getting by, by using alternative methods which are probably inefficient. |
DemonicK wrote:
But can I ask something, whats the difference between using .=..() and ..() If you use the forum search you'll find many explanations on this. The second one only calls ..() (which is the parent proc). Like any proc that is just called like that, whatever value it returns is lost as it's not used in any way (e.g. if you all you do in a statement is call rand(), it generates and returns a random number but you're not doing anything with it, so it's lost). The first one [is a normal assignation using the = operator and it] calls ..() and assigns what it returns to the variable named "." , which is a built-in variable that all procedures have as a local var (other vars like that are usr and src) . You could assign the value to any var you want, it's just that the . var is one that gets automatically returned when the proc ends if you don't explicitly return something different. The following two snippets are equivalent: mob/Move() mob/Move() Things of interest you may want to read up on in the DM Reference and other resources (use the forum search, for instance):
|