Results 1 to 5 of 5

Thread: Easy queston

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default Easy queston

    I am currently making a generator that generates rewards (simulation). How would I make it pick a random variable?

    Like pick a random one of these:
    Simba Code:
    Bpartyhat,Wpartyhat,Gpartyhat,Rpartyhat,Ypartyhat,Ppartyhat,boxopened:integer; //6
    pernixcowl,pernixtop,pernixlegs,virtushood,virtustop,virtuslegs,Crapier:integer; //7
    Cmaul,Cstaff,Bmelee,Brange,Bprayer,Bmage,Bagility,Btheiving,Bhuntig,Bmining:integer; //10
    Bsmithing,Bfishing,Bcooking,Bfiremaking,Bwoodcut,Dchain,Dlegs:integer

  2. #2
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by rjj95 View Post
    I am currently making a generator that generates rewards (simulation). How would I make it pick a random variable?

    Like pick a random one of these:
    Simba Code:
    Bpartyhat,Wpartyhat,Gpartyhat,Rpartyhat,Ypartyhat,Ppartyhat,boxopened:integer; //6
    pernixcowl,pernixtop,pernixlegs,virtushood,virtustop,virtuslegs,Crapier:integer; //7
    Cmaul,Cstaff,Bmelee,Brange,Bprayer,Bmage,Bagility,Btheiving,Bhuntig,Bmining:integer; //10
    Bsmithing,Bfishing,Bcooking,Bfiremaking,Bwoodcut,Dchain,Dlegs:integer
    Simba Code:
    case Random(4) of
          1: Bpartyhat;
          2: Wpartyhat;
          3: Rpartyhat;
          4: Ypartyhat;
    // and so on
        end;

  3. #3
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    Exactly how I would have done it^^^. Just make the case statement bigger, fill it with everything, and add a larger random to fit it.

    Its even more fun if you add a case statement in a case statement!
    ~Rez

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    So what would be the id statement for this

    if pick 1 then begin
    code here
    end;

  5. #5
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Can even do it a different way like this

    Simba Code:
    program new;

    var
    Items: TStringArray;

    procedure DeclareItems;
    begin
      SetArrayLength(Items,10) //set how many items we have including 0 (we have 10 currently)
      Items[0] := 'Bpartyhat';
      Items[1] := 'Wpartyhat';
      Items[2] := 'Gpartyhat';
      Items[3] := 'Rpartyhat';
      Items[4] := 'Ypartyhat';
      Items[5] := 'Ppartyhat';
      Items[6] := 'Bsmithing';
      Items[7] := 'Bfishing';
      Items[8] := 'Bcooking';
      Items[9] := 'Bfiremaking';
    end;

    function PickRandomItems(Amount: Integer): String;
    var
    i : integer;
    begin
      Writeln('Our '+ ToStr(Amount) +' items are:');
      Result := '';
      for i := 1 to Amount do
      Result := Result + Items[Random(Length(Items))]+', ';
    end;

    begin
    DeclareItems;
    writeln(PickRandomItems(3));
    end.

    Our 3 items are:
    Bsmithing, Ppartyhat, Rpartyhat,

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •