Randomness function?

A forum for discussing all things regarding modding of Eschalon: Book III
Post Reply
mbrowne
Steward
Posts: 66
Joined: January 30th, 2014, 7:01 pm

Randomness function?

Post by mbrowne »

Any chance there is a random # function available for scripts?
User avatar
SpottedShroom
Captain Magnate
Captain Magnate
Posts: 1372
Joined: June 4th, 2010, 6:18 pm

Re: Randomness function?

Post by SpottedShroom »

I requested a cond_random script directive over in the private Editing Tools forum, but didn't get a response either way from BW. I'm hoping 1.03 will have more mod support, possibly including this.

If you're interested in this stuff, ask BW to add you to the Editing Tools forum.
User avatar
BasiliskWrangler
Site Admin
Posts: 3825
Joined: July 6th, 2006, 10:31 am
Location: The Grid
Contact:

Re: Randomness function?

Post by BasiliskWrangler »

The problem with random numbers is: what do you do with it once you've generated a number? As far as I can determine, you'd need to somehow assign that random number to a variable in order to use it in any meaningful way...but the Eschalon scripting engine is so rudimentary it doesn't support variables.
See my ramblings and keep up with the latest news on Twitter & Facebook.
User avatar
SpottedShroom
Captain Magnate
Captain Magnate
Posts: 1372
Joined: June 4th, 2010, 6:18 pm

Re: Randomness function?

Post by SpottedShroom »

BasiliskWrangler wrote:The problem with random numbers is: what do you do with it once you've generated a number? As far as I can determine, you'd need to somehow assign that random number to a variable in order to use it in any meaningful way...but the Eschalon scripting engine is so rudimentary it doesn't support variables.
I was thinking it would just be a random percent chance that the script would continue executing, similar to the other cond_ keywords. Something like:

Code: Select all

cond_random 50; msg(You'll see this message half of the time)
User avatar
IJBall
Major
Major
Posts: 1684
Joined: August 31st, 2008, 11:07 am
Location: Southern California

Re: Randomness function?

Post by IJBall »

SpottedShroom wrote:
BasiliskWrangler wrote:The problem with random numbers is: what do you do with it once you've generated a number? As far as I can determine, you'd need to somehow assign that random number to a variable in order to use it in any meaningful way...but the Eschalon scripting engine is so rudimentary it doesn't support variables.
I was thinking it would just be a random percent chance that the script would continue executing, similar to the other cond_ keywords. Something like:

Code: Select all

cond_random 50; msg(You'll see this message half of the time)
Yes - you could also use something like this to "respawn" mobs in certain cases (e.g. stepping on a grid square, or opening a chest, etc.). So something like this could be very useful.

Besides - isn't there already a "random number generator" function in Book III?! If not, how else does Lucky's "game" work?... (Or is this another "special script" condition thing-ie?...)
mbrowne
Steward
Posts: 66
Joined: January 30th, 2014, 7:01 pm

Re: Randomness function?

Post by mbrowne »

IJBall wrote:
SpottedShroom wrote:
BasiliskWrangler wrote: Besides - isn't there already a "random number generator" function in Book III?! If not, how else does Lucky's "game" work?... (Or is this another "special script" condition thing-ie?...)
Then there's random loot. Conditional statements would be great.
Post Reply