Axe Software Forums
  Quest Developer Forum
  So, I invented time...


Author Topic:   So, I invented time...
I think Im Back posted 29-04-2003 06:17 BST     
Has anyone messed around with this idea? Having the current time running in the background of a game? I'm thinking for multiplayer games of course, but it could be used in single player games as well, I'm sure it would allow for a lot of tricky certain time of day puzzles as well as completing tasks and quests before a set time or date. I found it fairly easy to make with a few snags here and there, but eventually I was able to create a fully functional clock.

I found this interesting enough to post about because in my combat demo I was forced to use a rudementary set up of timers to enforce roundtimes. I'm capable of now giving players roundtimes as properties, then having the time that is constantly running in the background of the game determine when they are free to move again. This is a huge improvement. The one problem I'm having for the time being is that it seems very resource intensive(well would be for a large online game) to have to check every object in the game(or just the players and mobs) if it is incurring a roundtime. I'm brainstorming ways of getting around this... One way I've thought of is perhaps storing object names in strings prefixed with rt- and then having the time function only subtract time from those with pending roundtimes.

I don't know, this is all a ramble but I wanted some folks opinions on what would be a good way to code this.

Also, to Alex or someone more asl saavy than I, is there a way to have a variable that will use any number? That's a bad way of putting it, but say you have a bunch of objects, half named object1, object2, etc. and the other half named 1object, 2object, etc. Is there a way you can have asl seperate the two by say only having it look for objects named object%number-variable%. Instead of having to refer to a specific number to move it? I don't know if that makes sense. In essence could ASL find any object named 'object%any number here%' and move it to a specific location?

Alex posted 29-04-2003 15:23 BST          
Rather than horrid kludge using mangled object names, why not just set a property for those objects? I don't know exactly what you mean by "incurring a roundtime", but you could set a "roundtime" property to the value you want, and then manipulate these objects each turn using:

for each object in game {
if ( #(quest.thing):roundtime# <> 0 ) then {
' do whatever here...
}
}

I think Im Back posted 29-04-2003 17:39 BST          
That worked great. I always had a notion that you could do such with asl, but I never knew how. It's still not clear to me wether #quest.thing# is a built in variable that can mean any object, or if string variables themselves don't need to be defined and can refer to anything, but either(I'm guessing the second) way this has helped greatly. There should be some mention of such in the documentation as there is not much on variables.
Alex posted 29-04-2003 22:26 BST          
#quest.thing# is a built-in string variable, so it is set by Quest - all you need to do is use it. Every time the script inside the loop is run, it is set successively to the each object in the game.

It's mentioned in the ASL Reference under "for each object in...".