intfiction.org

The Interactive Fiction Community Forum
It is currently Sun Jul 22, 2018 7:46 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Jul 04, 2018 10:41 am 
Offline

Joined: Mon Apr 04, 2011 8:33 pm
Posts: 17
Hello again. I'm guessing this is another bone headedly simple question but... I think my issue is not knowing how to search for certain things... Anyway...
Is there a built in way to tell if a player has been in a specific room? I'd rather not use a bunch of custom variables if there's a built in method. I'm trying to make the scenery as robust as possible. But it seems awkward to keep describing 'Franks camp fire off in the distance' as an unknown flickering light off in the distance. Sooo....
I have tried bits found from several posts but they seem not directly related and have had no real success.
Again Thanks in advance for any clues. Please and thank you actually.
Sincerely,
- Selva


Last edited by Selva on Wed Jul 04, 2018 2:42 pm, edited 1 time in total.

Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jul 04, 2018 2:22 pm 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 999
Location: Greece
This is tracked by the 'seen' property. Even though you can use it directly, it's more future-proof to use the Actor.hasSeen() method instead, in case you decide to add multiple PCs later on.

Code:
if (me.hasSeen(kitchen)) {
    // The PC has seen the kitchen.
}


Note that if the PC has been to the room but it was dark and thus didn't actually see anything, hasSeen() will still return nil. The seen status is set to true when the Actor performs a lookAroundWithin() in the location and it's not dark.

This works for all Things, btw, not just rooms. If the object has been described to the Actor in question, hasSeen() will be true for that object:

Code:
if (me.hasSeen(blackBox)) {
    // The PC has seen the black box.
}

_________________
@realnc


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jul 04, 2018 2:41 pm 
Offline

Joined: Mon Apr 04, 2011 8:33 pm
Posts: 17
I didn't realize rooms even had that property. That works even better than what I was trying. Thank you!!!


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Jul 04, 2018 2:57 pm 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 999
Location: Greece
Selva wrote:
I didn't realize rooms even had that property. That works even better than what I was trying. Thank you!!!

That property is in Thing, and since rooms also inherit from Thing, they got that property too.

It might be a good idea looking at the thing.t file. Usually you discover stuff that's already handled for you but you didn't know existed.

_________________
@realnc


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jul 05, 2018 2:33 am 
Offline

Joined: Mon Apr 04, 2011 8:33 pm
Posts: 17
RealNC wrote:
It might be a good idea looking at the thing.t file. Usually you discover stuff that's already handled for you but you didn't know existed.


Ow my head hurts. Thank you for the advice. I fear that the behind the scenes coding might be slightly over my head but I'll check these first from now on. I'll try not to be too much of a pest. I appreciate the patience.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group