Friday, February 10, 2012

Just because it's lazy doesn't mean I ain't thinking

So next up is to re-write how jobs work. Right now it is a twisted mess that I am just amazed works on most day and I hate it has to be fixed.

So the main problem with actually triggering jobs is that you can't use

roomGo(1)
roomGo(2)
roomGo(3)
roomGo(4)

or a sequence of functions. Because the damn user wants to see stuff happen rather just have it happen instantly. Damn you game players!!!

So then comes the recursion idea... God I hate recursion. For those of you who don't know what recursion is your a very lucky person. But basically we would end up with a function grouping of

roomGO(roomGo(roomGo(roomGO)))) (No it wouldn't be programmed like that but its basically how it would work.)

That just is aggravating! Also we need to have a way to add events that suddenly happen. The farmer comes by. New class is offered etc. By the way this is the current way it is working and for a long while I thought I would be stuck doing it this way... But on the can today I had a eureka moment.

Why not do it as an array! In the same way that you do text why not do an array of all the events at the start.

event = {roomGo(1), roomGo(2), roomGo(3), ... etc).

Then we just pop off the top job complete all the stuff and pop off the next job and if there is something that needs to be added well we push it to the top of the array such as a class job. And no recursion.

So will be playing with that tonight. That was a lot of text...

Daisy

No comments:

Post a Comment