PDA

View Full Version : Randomising!


Matthew Walters
05-22-2001, 09:47 AM
Is there a way of AMS generating a random number?

eg I want to create a list of 'Tips for the day', then randomly select from the list (either in a .INI file or in the registry).

If not random, i'd even be happy with a counter, to store an incrementing value every time the CD is run. Then recall this value and pick the corresponding tip.

The only way I can see at the moment is a quick VB program to write the random seed, and run this whenever the CD starts.

[Hint: to create a checkbox, create two graphics - one with an empty square and one with a 'check'. Standard graphic is the empty box, then show the 'checked' box on a mouse click event - at the same time set a variable '%checked%'. Then using a bit of boolean, you can return to unchecked next time the box is clicked. ie to disable my 'Tip of the day' once I've got it working http://www.indigorose.com/ubb/images/icons/smile.gif ]

dallasfreak
05-22-2001, 10:24 AM
Set your menu so that the on project open it reads the registry for tip number. Then it would display a tip coresponding to that number if %checked% equlas checked. Then when you click close on the tip box, it would write a new value to the registry for the next tip number. Next time menu is run, it would read the new value, and show the new tip.

IE. the menu reads a value of 1 as the tip number. It also reads %*check% as checked. It then SHOW OBJECT tip1. The user closes the chek box, which then writes a value of 2 as the tip number in the registry. Next time menu is ran, it reads a value of 2 and checked, then shows obect tip2.

The explanation may kinda suck, but it should be pretty easy to do. Im adding this feature to mine, just haven't coded it yet
http://www.indigorose.com/ubb/images/icons/frown.gif. Good idea for the check box. I may have to steal it from you.

Matthew Walters
05-22-2001, 10:50 AM
Thanks dallas - good plan. Use the mouseclick event on a 'close' button, Tip1 text = "Hello this is tip one", Tip1Val=2.

So...When Tip1Val is set, the next tip to load is '2', which has text of "Blah" and Tip2Val=3.

It 'thinks' right, but I'll have to code it and see.

dallasfreak
05-22-2001, 10:52 AM
If you need any help coding, let me know. I'll write it and email it to you. Remember registry is your friend. Use it to the fullest extent possible.

Matthew Walters
05-22-2001, 10:56 AM
Thanks dallas. I'll let you know how i get on. As far as i can see, two variables are needed for each tip - one with the text, and one with the next tip value, unless there's a way of doing math(s) in AMS.

dallasfreak
05-22-2001, 11:08 AM
thats how im seeing ti for now. havent really played with it yet, but that would be easiest way

Matthew Walters
05-22-2001, 11:08 AM
...or of course use the 'increment' option when modifying an existing registry key.

dallasfreak
05-22-2001, 11:32 AM
at the last tip though, you would need it to set back to 1

Matthew Walters
05-23-2001, 09:44 AM
Hi dallas. Solved it using an ini file. mail me if you want to have a look at the ams file: matthew.walters@thorlux.co.uk