Frictional Games Forum (read-only)

Full Version: (Request) Moving Shelf using Secrets Books
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Without knowing anything about it, I believe "&in" is used when the game istelf feeds you an object as a string. In a collide callback there is no place in the script where you tell call the callback with an object. It just takes any object that collides and passes the naming criteria. So the "&in" part probably means that you're expecting any object.

Technically you do say what you expect in void OnStart, but the function doesn't know that. It just knows that there is a parent and a child, and both could be many different objects.
Here are the docs for it:

What &in means is that it only acts as input (as you'd expect) and it cannot be modified back out. It basically makes a copy of the original value and lets you play with it locally. It says that it has little benefit other than slight performance improvements in certain cases, especially while also using const.

&out on the other hand is a little more interesting. It lets you modify the direct value that was given. From what I understand, you can do this:

PHP Code:
void OnStart() {
int value 5;



void process(int &out value) {
value 10;

Running this would print out 10, whereas if it were &in, it would give you 5. Do you see why?

Also, apologies for going off-topic. OP, you can respond whenever if you got your issue resolved.
Sorry, have been busy lately. Now I'm back.

(05-07-2017, 02:03 PM)Mudbill Wrote: [ -> ]Well, I opened the map and saw that you didn't name your books correctly. They are named book_moveable_1 instead of book_1 as the script asks for.

I tested it and now it works just fine.
Oops, my bad.

Now I have trouble pulling the books back to the start position, when pulled the wrong book.

I added the AddPropForce (It's the only methode I can think of, correct me I'f I'm wrong) in a timer at the wrong book event.
PHP Code:
void PullBook(string &in asParentstring &in asChildint alState) {
asParent == StringSub(asParent0asParent.length() - 1) + bookCounter) {
AddDebugMessage("Pulled the correct book. Number: " bookCounterfalse);
    } else {
AddDebugMessage("Pulled the wrong book. Number: " bookCounterfalse);
bookCounter 1;

bookCounter 3) {
AddDebugMessage("Completed the puzzle!"false);

void resetbook(string &in asTimer)
AddPropForce("book_1"00, -180"world");
AddPropForce("book_2"00, -180"world");

Does ResetProp not work? Because I'm a bit unsure if the prop force will work due to how the physics works on the book.
Oh, I completely forgot about ResetProp. Thanks.
Pages: 1 2