Using SETCHANCE to ...
 
Notifications
Clear all

Breaking Using SETCHANCE to select between four messages at random

1 Posts
1 Users
0 Reactions
272 Views
Posts: 19
Admin
Topic starter
(@hilvar)
Member
Joined: 3 years ago

Coming in the next update is the SETCHANCE [FlagID] instruction which was requested by @CriticalFailure.

I wanted to give a small example of how this could work to produce a choice between a fixed number of random messages.

Load up the example you entered from the manual or one of your own files you can play with first so you have some locations and other data.

To begin, we will need four messages. I'm going to start the messages at ID 5 and the user flags we are using are ID 10 and 11:-

5 - Both Less

6 - 10 Less, 11 Greater

7 - 10 Greater, 11 Less

8 - Both Greater

To produce these messages I'm going to use the Status table but they could just as easily be added to an Event with particular words. To keep them out of the way we'll use Section 10 and Priorities 128 - 131.

128 - Conditions - LT 10 50, LT 11 50 - Instructions - MSG 5

129 - Conditions - LT 10 50, GT 11 49 - Instructions - MSG 6

130 - Conditions - GT 10 49, LT 11 50 - Instructions - MSG 7

131 - Conditions - GT 10 49, GT 11 49 - Instructions - MSG 8

Remember the two conditions go on separate lines in the IFAC editor. Shown here on one line to save space.

Finally we need a Status entry to give the flags new values every turn. It has to have higher precedence than the entries immediately above so we will put it in Section 9 Priority 250:-

250 - Conditions - NOTAT 1 - Instructions - SETCHANCE 10, SETCHANCE 11

Now if you go to test the adventure every single turn one of the four messages should appear which will depend on the values in the flags. You can check this yourself by going to the Flags tab while you are testing to see the current values.

This example uses Status as it is the easiest to set up but can just as easily produce a randomized response (not just a message) to a button press or any other event by moving the entries into the Event table and attaching them to the users verb noun input commands.

 

 

Share: