AminetAminet
Search:
84782 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/batch/random.lha

Mirror:Random
Showing: i386-aros icongeneric icon
No screenshot available
Short:Output a random number for use in scripts, etc.
Author: krf101 at york.ac.uk (Kevin Fairhurst)
Uploader:krf101 york ac uk (Kevin Fairhurst)
Type:util/batch
Architecture:m68k-amigaos
Date:1996-10-14
Download:util/batch/random.lha - View contents
Readme:util/batch/random.readme
Downloads:340

Usage:

   The correct usage of 'Random' is to pass it a single argument. This value
is the maximum number you want considered i.e. that a random number will be
picked between 1 and this number.

   For 'Random' to work correctly, the number MUST be between 1 and 65536.
Numbers outside this range (or failure to pass numbers, eg passing
a string of letters) will cause 'Random' to behave as outlined in the
examples that follow:

1> Random

      outputs a number between 1 and 65536

2> Random 0

      same as example 1

3> Random a  (where 'a' is a positive integer between 1 and 65536 inclusive)

      outputs a number between 1 and a

4> Random b   (where 'b' is a positive integer greater than 65536)

      outputs the number 1

5> Random c   (where 'c' is any negative integer)

      outputs c + 1

6> Random text

      same as example 1

7> Random 123 456 789

      outputs a number between 1 and the first argument (in this case 123)

8> Random "more text"

      same as example 1

9> Random "123 456 789"

      same as example 1


   What you do once you have your random number is up to you. One idea is if
you want random backdrops.  Say you have 5 different backdrop settings that
you wish to choose from at every boot. Save them to prefs/presets with
different filenames (WBPattern_1.prefs, etc. would be a good start). Then
edit 5 scripts in your S: drawer, named 1.bat to 5.bat.

   Script 1.bat copies WBPattern_1.prefs to env:sys/WBPattern.prefs, and I
hope I don't have to tell you what 2.bat - 5.bat do ...

   AFTER everything has been copied from ENVARC:SYS to ENV:SYS in your
startup-sequence, but before IPrefs is called, add the following lines:

      Random 5 >ENV:WBP
      Run <>NIL: Execute S:$WBP.bat

(For those who don't know, using <>NIL: is the same as using <NIL: >NIL:)

   As long as you have 'Random' in your path somewhere, along with Run and
Execute, every time you boot your backdrop settings will be chosen randomly!

   Other ideas are to incorperate the RequestChoice command to have a dead
good (honest!) game.  See the file Game.bat which should have come with this
program for an example of this.


-->8--------------------------------------------------------------------8<--

   If you wish to complain/comment/send cash then either email me at the
above address, or write to me at

   Kevin Fairhurst
   Goodricke College
   University of York
   Heslington
   York
   YO1 5DD
   England

   Also, check out my homepage on http://www.york.ac.uk/~krf101


Contents of util/batch/random.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                  570    1226  46.5% -lh5- 800e Sep 17  1996 Game.bat
[generic]                  953    1256  75.9% -lh5- de39 Sep 17  1996 Random
[generic]                 1245    2675  46.5% -lh5- 6fa9 Sep 17  1996 Random.readme
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total         3 files    2768    5157  53.7%            Oct 14  1996
Page generated in 0.02 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>