[Circle] NEWBIE: help with random.

From: Cyber Reaper (Reaper@cyber.reno.nv.us)
Date: 08/01/96


well, I am looking to make a ACMD (do_retreat), it will be like flee but you
dont leave the room. I already have it for gods:

--snip--
ACMD(do_retreat)
{
 if (GET_POS(ch) == 7){
          if (FIGHTING(FIGHTING(ch)) == ch)
            stop_fighting(FIGHTING(ch));
          stop_fighting(ch);
        }
  }
--snip--

and it works fine, but it ALWAYS works, so I cant give it to the players.
what I need to know is how to get a random number, ie

(this may not work, its just off the top of my head!)

ACMD(do_retreat)
{
int chance, roll;

chance=(GET_LEVEL(ch));
roll=(random 34);
if (chance => roll)
   {
if (FIGHTING(FIGHTING(ch)) == ch)
            stop_fighting(FIGHTING(ch));
          stop_fighting(ch);
        act ("You step away from battle...... ect. (all the messages would
be in here somewhere)
   }
}



but you get the idea, now how do I do the random 34 part? am I even on the
right track? I dont want to make it a skill (I am not skilled enuff for that
yet!).

I thank you for any help!!!1
        
Cyber Reaper
Realms of Reality
***UNDER CONSTRUCTION!!!***
telnet://login.greatbasin.net 4000

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/07/00 PST