Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
kslwwein
Newbie


Joined: 22 Nov 2021
Posts: 1

PostPosted: Mon Nov 22, 2021 3:08 pm   

Capturing Randomness
 
So there’s a point in “my” game where one location, #open-desert, is a boundless area; it loops back to itself, but varies the text description and some background objects every time you move.
Code:

#open-desert
(room *)
(name *) Open Desert
(inherently dark *)
(look *)
    (select)
        Clouds of dust swirl through the air
    (or)
        The dust storm rages around you
    (or)
        Your tracks are swallowed up in moments by the billowing sand
    (or)
        The desert stretches around you in all directions
    (at random)
    , and
    (select)
        you shiver in the chill night air
    (or)
        you plod wearily through the sand
    (or)
        you wish you could see more than twenty feet in front of you
    (or)
        god damn it's dark
    (or)
        every inch of sand looks just like every other
    (at random)
    .
    (par)
    (visible flotsam $Flotsam)
    (select)
        All you can make out in the darkness
        (is $Flotsam) (a $Flotsam)
    (or)
        You can sort of see (a $Flotsam)
    (or)
        Nearby: (a $Flotsam).
        Nothing to write home about
    (or)
        Half-lost in the shadows, you see
        (a $Flotsam)
        and that's about it
    (at random)
    .

The problem with this is that if you look twice in the same room, the description changes.

So I was thinking; could it be possible to “capture” the RNG and restore it? Something like:
Code:

(narrate entering *)
    (collect $Flotsam)
        *(desert flotsam $Flotsam)
        (now) ($Flotsam is nowhere)
    (into $List)
    (shuffle list $List into $Shuffled)
    (take 3 from $Shuffled into $Final)
    (exhaust) {
        *($F is one of $Final)
        (now) ($F is #in *)
    }
    (now) (visible flotsam $Final)
    (capture randomness $Random)
    (now) (desert description randomness $Random)
    (par)
    (try [look])

and
Code:

(look *)
    (desert description randomness $Random)
    (using randomness $Random) {
        (select)
            Clouds of dust swirl through the air
        (or)
            The dust storm rages around you
        (or)
...
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4429
Location: Pensacola, FL, USA

PostPosted: Mon Nov 22, 2021 9:51 pm   
 
You can always just check the box for room description changes.

It's in configuration settings under config on the map window menu bar.
Configuration tab on the left.
Room Description tab along the top.
_________________
Discord: Shalimar#3679
Reply with quote
faisal70
Newbie


Joined: 25 Nov 2021
Posts: 2

PostPosted: Thu Nov 25, 2021 6:10 am   
 
Hello, it is possible to intercept an RNG and restore it, you only need to check the box for changing the room description and then everything should be fine, I did and it works normally as it should, although I have been thinking for a long time how to do it and whether it is possible
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4429
Location: Pensacola, FL, USA

PostPosted: Thu Nov 25, 2021 10:58 am   
 
It is possible, but unless you are going to be doing anything based on those details, I'm not sure I see the point.
_________________
Discord: Shalimar#3679
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net