Discussions
Sign In
Forum rules
- please read before posting.
Access Journal via code
njb
September 2015
in
Technical Q&A
Hi There,
Can you advise as to where I can access the journal pages via code.
I believe they are stored in playermenus.cs?
I need to access the content of the diary page via an id.
Thanks
Nic
Comments
ChrisIceBox
September 2015
It's in MenuJournal.cs, but accessed through PlayerMenus.
PlayerMenus.GetElementWithName ("MyMenu", "MyJournal");
However, that will return a MenuElement class (the base class), so you'll need to cast it:
MenuJournal theJournal = null;
MenuElement theElement = PlayerMenus.GetElementWithName ("MyMenu", "MyJournal");
theJournal = (MenuJournal) theElement;
Now you can access the journal's pages, which are in it's
pages
variable.
JournalPage[] pages = theJournal.pages.ToArray ();
Sign In
or
Register
to comment.
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Quick Links
Categories
Recent Discussions
Categories
12.6K
All Categories
66
Official news
1.5K
Engine development
10.6K
Technical Q&A
337
Games showcase
151
Extending the editor
229
Adventure talk
Welcome to the official forum for Adventure Creator.
Forum rules
Main website
Store page
Community wiki
Community Discord
Powered by Vanilla
Comments
PlayerMenus.GetElementWithName ("MyMenu", "MyJournal");
However, that will return a MenuElement class (the base class), so you'll need to cast it:
MenuJournal theJournal = null;
MenuElement theElement = PlayerMenus.GetElementWithName ("MyMenu", "MyJournal");
theJournal = (MenuJournal) theElement;
Now you can access the journal's pages, which are in it's pages variable.
JournalPage[] pages = theJournal.pages.ToArray ();