View previous topic :: View next topic |
Author |
Message |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Thu Mar 04, 2004 5:18 pm Post subject: Random command |
|
|
Is there a way to exclude numbers in a random command? Like, if it's between the low number and the high number, and you don't want it to be a result?
Say, for instance, I have an npc that's walking in a random direction, but, if it's right next to a wall on the right, I want to exclude right from the equation. The script would be like this:
Code: | variable (direction)
direction := random (0,3)
walk npc (0,direction) |
If it's up against the wall, it could still walk right, so I want to exclude 1, since the directions, as defined in plotscr.hsd, are:
0 = up
1 = right
2 = down
3 = left
Any insights? |
|
Back to top |
|
 |
Sephyroth Renegade Rebel Redmage Class A Minstrel

Joined: 04 Feb 2003 Posts: 644 Location: Schmocation
|
Posted: Thu Mar 04, 2004 7:08 pm Post subject: |
|
|
The best thing I could think of is a for loop that goes through the random number selection until it hits a direction that's not obstructed, though I'd expect that it'd slow down a game quite a bit. _________________ im realy ded  |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Thu Mar 04, 2004 7:25 pm Post subject: |
|
|
Actually, unless something like 95% of all choices are rejected, you should notice no slow down. The HS interpreter can perform arithmetic and large amounts of simple commands quite quickly. Go with what Sephy said. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Shineyest What I say is what I am

Joined: 10 Mar 2004 Posts: 21 Location: Here
|
Posted: Thu Mar 11, 2004 12:33 pm Post subject: |
|
|
but doesnt it depend on how quick the computer is more than the hs code _________________ I am making a game about thieves |
|
Back to top |
|
 |
Fenrir-Lunaris WUT

Joined: 03 Feb 2003 Posts: 1747
|
Posted: Thu Mar 11, 2004 1:26 pm Post subject: |
|
|
Correct me if I'm wrong, but I seem to remember that the OHR only uses at most 600 something Kilobytes of Memory. That's roughly what the Viking Space Probes had to work on, if memory serves. When your memory is full, the game or even custom will completely lock up. As it is, the OHR's memory usage is nearing its limit, so no, a faster computer would NOT have that much of a tactical advantage over a slower one, rather the speed of your scripts is what's important. |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Thu Mar 11, 2004 4:16 pm Post subject: |
|
|
Fenrir-Lunaris wrote: | Correct me if I'm wrong, but I seem to remember that the OHR only uses at most 600 something Kilobytes of Memory. That's roughly what the Viking Space Probes had to work on, if memory serves. When your memory is full, the game or even custom will completely lock up. As it is, the OHR's memory usage is nearing its limit, so no, a faster computer would NOT have that much of a tactical advantage over a slower one, rather the speed of your scripts is what's important. |
A faster computer will run scripts faster, but a computer with more memory (RAM) will not improve anything. (In fact, I don't think it is even possible to find a computer anymore that doesn't have enough RAM for the OHR) |
|
Back to top |
|
 |
|