Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Random command

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Thu Mar 04, 2004 5:18 pm    Post subject: Random command Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Sephyroth
Renegade Rebel Redmage
Class A Minstrel



Joined: 04 Feb 2003
Posts: 644
Location: Schmocation

PostPosted: Thu Mar 04, 2004 7:08 pm    Post subject: Reply with quote

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 Sad...
Back to top
View user's profile Send private message Send e-mail AIM Address
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Mar 04, 2004 7:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Shineyest
What I say is what I am




Joined: 10 Mar 2004
Posts: 21
Location: Here

PostPosted: Thu Mar 11, 2004 12:33 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Thu Mar 11, 2004 1:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Thu Mar 11, 2004 4:16 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group