# Random Probability Drive - possible?

I would like to create an outfit which acts like the Random Probability Drive from the "Hitchhiker's Guide" writings- it would transport the player to a random system at the push of a button. If it could also change the player's ship to a random choice of maybe 6 ships, that would be cool too. Mostly I would just like to move the player to a random place. I am very new to making plug-ins so I am not sure what I should adjust and where it should be adjusted. I have read the bible from top to bottom but am having trouble understanding how to write bit strings (I suspect those bit strings might be my ticket to success)

Does anybody have an idea?

Thank you!

That's a really, really interesting concept. I'm not entirely sure how to do it at the push of a button, so to speak, but I would think the easiest way to do it would be to have two crons that evaluate every so often and come up with a random bit set, then a another cron that would randomly evaluate the bit sets and force the player into another system and/or ship. I suppose you could do it with constant missions. When the player buys the outfit, have it start two crons, one for randomly setting the system bits, and a second that randomizes the ship type bits, as well as activating a mission that evaluates those bits on abort. When the player aborts the mission, "activating" the random probability drive, it would evaluate the currently set bits and choose the appropriate system and ship type to force the player into. The mission would then re-activate itself on abort, keeping the probability drive mission active. There's probably a far more elegant solution that I'm not seeing, though.

Yes, mission bit expressions are what you're looking for. The following set expression, for example, will transport the player to either system 128 or system 129, and change his/her ship to either 130 or 131:

R(N128 N129) R(H130 H131)

N is one of two methods for moving the player, H is one of three methods for changing ships, and R is the random selection.

The trick, as krugeruwsp says, will be to work out how you'll cause that expression to be activated.

Actually, I suppose you wouldn't need the crons at all, now that I think about it. You could just have the mission on abort randomly choose one of the options through the R (Nxxx) and R (Hxxx) or R (Cxxx) expressions, and re-activate the mission through the Sxxx expression. I believe that would be the simplest way to do it, but there might be something I am missing.

Hxxx puts you in a new ship while eliminating any nonpersistent outfits you have and granting you the stock outfits for the new ship, while Cxxx puts you in the new ship and keeps all your old outfits instead of granting you the ones that come with that ship. I think the second one is probably what you want, if you're pondering what I'm pondering.

Thanks for the tips, crew! The strings you gave me are probably just what I'm looking for. I would tell you whether or not they actually work, but I haven't been able to get any missions I have made to be available.

Like I said, I'm very wet behind the ears when it comes to writing plug-ins. I am pretty confused about ncb's and set/test expressions. If any one would like to give me a tutoring, that would be great. I realize we all have our own lives and maybe teaching a noob isn't going to fit in your schedule, so I can understand if I'm asking a lot.

Thanks again for the responses!

This post has been edited by Ollie Tabooga : 29 June 2011 - 05:50 AM

@ollie-tabooga, on 29 June 2011 - 05:50 AM, said in Random Probability Drive - possible?:

I am pretty confused about ncb's and set/test expressions.

The most basic thing you need to know is that test expressions are for finding things out, and set expressions are for doing things.

A test expression, for example, is what decides whether a mission will be available, or a ship be offered for sale. For example, if a mission's test expression is b1 & !b2, it will be offered only if bit 1 is set and bit 2 is clear. This is how you make a storyline progress without a mission being offered either too early or more than once. (Notice that the elements of a test expression are related: the ampersand means that the elements on both sides have to be set, whereas the 'or' sign, |, would return true if either item were true. And of course the exclamation mark negates what comes after it.) If you aren't already familiar with boolean (true/false) logic, you might want to read up on it a bit.

When the mission completes, it executes a much simpler set expression. The elements of a set expression aren't related; it's just a list of things to be done. The hypothetical mission from above would, on completion, set b2, meaning that it won't be offered again. (There's also a separate set expression that executes if the mission fails. Here, you could write !b1 !b2 !b3, causing the player to be kicked back to the beginning of the story if he/she fails the mission.)

The next mission in the sequence would have the test expression b2 & !b3, and the set expression b3, and so on, so that the story would progress one mission at a time.

Of course, there are things other than bits that you can set or test, and places other than missions that you can put expressions. You can, for example, use a test expression to determine whether a ship should be offered for sale, and run a set expression when the player buys it; krugeruwsp also mentioned crรถn resources, which can be set to launch automatically without player intervention.

This is all simpler to do than it is to explain, I'm afraid.

I believe you also would not want to have the mission offered in the bar or anywhere else so much as you want to have it activated when the player buys the outfit through the Sxxx expression. So, in the outfit resource, you want to find the "on purchase" field. In there, you will put Sxxx (where the xxx is the mission ID that you will be creating.) Have the mission fail "on sell" using the Fxxx expression.

Then, create a mission resource with the appropriate ID. When the mission fails, it simply ends. In the "on abort" field, you would have it use the Cxxx/Hxxx expression combined with the Nxxx/Mxxx expression, with all the choices in parenthesis and an R on the outside of the parenthesis. You also want Sxxx in the "on abort" field, to activate the mission again.

I think, but I'm not sure on this, that you can get away with not having description texts for on fail and on abort. You will need a quick brief text for the mission to show up in the mission list and be understandable to the player. You create that in the desc resources.

Are you using Mission Computer or EVNEW?

This post has been edited by krugeruwsp : 29 June 2011 - 10:05 AM

This topic may be of interest to you, it describes a method for having the nova engine pick randomly from 3 or more options with equal probability of picking any option. Simply using R(xxx) expressions limits you to 2^n options with equal probability, rather than any number of options with equal probability.

http://www.ambrosias...howtopic=130013

Wow, it has been a while since I have been able to get back to working on the plugin.

I use EVNEW on my windows machine. With the bits, how do I know which ones I can use?

In the editor, there are fields for (and what I think they do)
Available bits (what bits need to be set to make this mission available)
On Accept (which bits set when you accept)
On Refuse ("""""refuse)
On Success (""""" succeed)
On Failure (""""" fail)
On Abort (""""" abort)
On Ship Done (""""" complete the ship goal)

If my assumptions are correct, am I just filling in the "#" signs with numbers of my choosing? ex: b#### -> b2345 as is my wont

I should be keeping track of which bit numbers I decide to use and that way I can insert the correct bits into my missions/outfits/ships/whatnot.

Am I getting this right?

Yes, you are understanding correctly. Each bit doesn't have to be 4 digits, though. It could just as easily be b3 or b46 or b528. The smallest bit you can use is b0 and the largest is b9999. I'm not sure which bits are unused, however I believe there's a bitmap somewhere on the net that does specify that. Possibly in the Nova Bible, but I'm not positive.

Dropping in for a quick nitpick: It's called the Infinite Improbability Drive. At least, that's the name in the book.

Okay. I'm relieved to have figured out the bit part. What I haven't figured out is how to make my missions run. I wrote a mission for my character to start at the beginning of the game. I think I set the pre-reqs for availability correctly, but I can't get the mission to be offered, so I can't test any other part of it.

Here (I think) is the plug on dropbox: http://dl.dropbox.co...7924400/MMP.rez

It's for Windows and I hope some can take a look it and help me figure out how to make (misn2000 "Find map and bring to old man") work correctly. It should be offered in the Bar when the player visits "Hora". "Hora" is the spob I created in the upper left part of Capella.

I haven't written anything for the mission besides the offer text, and this copy of the file has no bits written into it.

Do I need to flesh out the mission completely for it to be offered?

On a little bit of a tangent, where is the str located for the beginning of the game, where it suggests landing, it reminds you about how you can't jump until you move away from the spob, and tells you you won't find anything out it space unless you jump. I would like to turn these off.

Thanks you all for your help!

and thanks for correcting the name of the hyperdrive. I'll make sure to include the proper footnotes or asterixes to differentiate my drive from Mr. Adams' for copyright purposes

Also: I tried to download the bits bible from the add-ons page and it is in sit.hqx format which I haven't been able to open. Does anyone have a copy of it in Word or PDF format?

This post has been edited by Ollie Tabooga : 11 August 2011 - 10:26 AM

Oh, God. sit.hqx format?

That's an old Mac file-compression format (analogous to .zip and .rar). Far as I know, the only program that can open them is Stuffit. I'm not even sure it handles those file types anymore.

@starsword, on 11 August 2011 - 11:06 AM, said in Random Probability Drive - possible?:

Oh, God. sit.hqx format?

That's an old Mac file-compression format (analogous to .zip and .rar). Far as I know, the only program that can open them is Stuffit. I'm not even sure it handles those file types anymore.

Thanks! I dl'd the program and now I have a shiny copy of the bit bible as a wonderfully assembled excel file. This will be most helpful for keeping bits from crossing. Don't cross the streams!

@ollie-tabooga, on 11 August 2011 - 11:28 AM, said in Random Probability Drive - possible?:

Thanks! I dl'd the program and now I have a shiny copy of the bit bible as a wonderfully assembled excel file. This will be most helpful for keeping bits from crossing. Don't cross the streams!

Could you maybe reupload it in a more commonly used format? Like, say, ZIP? (If it's smaller than 100K, you can attach it to a BBS post here.)

@starsword, on 11 August 2011 - 01:01 PM, said in Random Probability Drive - possible?:

Could you maybe reupload it in a more commonly used format? Like, say, ZIP? (If it's smaller than 100K, you can attach it to a BBS post here.)

Here goes!

excel file: http://dl.dropbox.co..._Bits_Bible.xls
document: http://dl.dropbox.co...0Discussion.txt

This is 2 files from the .sit.hqx pack. It included a .rtf version of the excel file so it could be pasted into a spreadsheet program other than excel, and a readme explaining this, BUT I chose to only keep the excel file and a informative document about possible bit explanations which weren't fully explored.

Also, credit is due and all kudos should rightfully be directed toward a person who may or may not be called Mark Chai from Australia. "Anonymous" uploaded the original file to the add-ons page in 2004 with a link to a now defunct webpage promising updates.

For the original file, see: http://www.ambrosias...category=Guides