Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help (Request) Moving Shelf using Secrets Books
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#11
RE: (Request) Moving Shelf using Secrets Books

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.

Trying is the first step to success.
(This post was last modified: 05-08-2017, 09:55 AM by FlawlessHappiness.)
05-08-2017, 09:54 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#12
RE: (Request) Moving Shelf using Secrets Books

Here are the docs for it: http://www.angelcode.com/angelscript/sdk...c_ref.html

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: (Select All)
void OnStart() {
    
int value 5;

    
process(value);

    print(
value);
}

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.

(This post was last modified: 05-08-2017, 01:38 PM by Mudbill.)
05-08-2017, 01:29 PM
Find
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#13
RE: (Request) Moving Shelf using Secrets Books

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: (Select All)
void PullBook(string &in asParentstring &in asChildint alState) {
    if(
asParent == StringSub(asParent0asParent.length() - 1) + bookCounter) {
        
AddDebugMessage("Pulled the correct book. Number: " bookCounterfalse);
        
bookCounter++;
    } else {
        
AddDebugMessage("Pulled the wrong book. Number: " bookCounterfalse);
        
bookCounter 1;
        
AddTimer(""0.1f"resetbook");
    }

    if(
bookCounter 3) {
        
AddDebugMessage("Completed the puzzle!"false);
        
SetMoveObjectState("shelf_secret_door_1"1);
    }


void resetbook(string &in asTimer)
{
        
PlayGuiSound("wrong_book.ogg"1.0f);
        
AddPropForce("book_1"00, -180"world");
        
AddPropForce("book_2"00, -180"world");
        
AddPropForce("book_3"00180"world");

(This post was last modified: 05-14-2017, 10:23 AM by User01.)
05-14-2017, 10:21 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#14
RE: (Request) Moving Shelf using Secrets Books

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.

05-14-2017, 12:32 PM
Find
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#15
RE: (Request) Moving Shelf using Secrets Books

Oh, I completely forgot about ResetProp. Thanks.
05-14-2017, 01:58 PM
Find




Users browsing this thread: 2 Guest(s)