Script Help

efgosser
22 Jan 2007, 19:12
I want to randomly put 12 random items in the game in 100 random locations every 35 seconds and if their are 4 in that room don't put new item?

Elexxorine
22 Jan 2007, 20:24
First of all, WHY!!!!! Secondly, this is going to take a bit of coding.... Reversing the english, you get 'every 35 seconds, put 12 items in 100 rooms'. Now do you want 12 items in each room or 1 in each roomm up to maximum of 12 items? Also counting the number of items in a room is merderously horrible too...... I'll come back to you on this one, though a little more context will help me understand what you want better.

efgosser
23 Jan 2007, 04:40
It is 12 items, 100 locations, each item has a specific locations were it can go. Every 35 sec a random item is generated to the map, depending on the item is what random map number it is generated to. I just thought I would throw that out there, because I was talking to another and he said "you don't have to code Quest, ask anyone" Thank you for your answer. I can figure it out, I just have to learn ASL's language.

paul_one
23 Jan 2007, 10:52

Also counting the number of items in a room is merderously horrible too

I dunno.. A simple loop does that easily.

So you want one object - from a selection of 12 objects - to be generated at random anywhere in a selection of 100 rooms.. Every 35 seconds.
Kinda reminds me of games like doom... Except I'm sure it's not every 35 seconds.

efgosser
23 Jan 2007, 12:36
1. timer 35sec
2. RND 100 locations
3. is their 4 gems
4. yes: go back to 1 "wait 35sec"
5. no: RND 11 "10 in 11 shot to be a garnet"
6. is 1 to 10
7. yes: then place garnet
8. no: RND 12
9. place gem

Overcat
23 Jan 2007, 12:46
A simple naming convention on the room names, and this is really quite simple. I'm sure more than one of us here could code that up in less than 5. Let us know if you'd like an example, or, if you just want to figure it out on your own. (You seem like you will, in any case.)

paul_one
23 Jan 2007, 17:26
I really just wanted clarification before coding anything.
So the 4 gems is the number is a specific room and not across the 100 rooms?

Elexxorine
24 Jan 2007, 09:02
Lol. Tron, how could I be so stupid?!
define timer <gem.timer>
interval <35>
enabled
action for <#room[i]#; 1; 100> {
set numeric <objects[i]; 0>
for each object in <#room[i]#> set numeric <objects[i]; %objects[i]% + 1>
if ( %objects[i]% < 4 ) then do <place.gem(i)>
}
end define
Then you've have to define the place.gem procedure, with the first parameter as the room you're putting it into...

paul_one
24 Jan 2007, 18:10
That makes sure there's 4 items in 100 rooms every 35 seconds..

It should be:
action {
set numeric <rnd.room; $rnd(1;100)$>
for each object in <#room[i]#> {
if property <#quest.thing#; gemstone> set numeric <objects; %objects%+1>
}
if ( %objects% < 4 ) then do <place.gem(#room[i]#)>
}


If you wanted it overall, then you'd then need to loop through all the rooms - still only keeping one objects var though.

Arbutus
24 Jan 2007, 19:12
Depending on how many times the timer runs, you could end up with a mountain of garnets in each room! Are you placing garnets from a predefined set or cloning or creating them? Interesting exercise.