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
Error expected method or property
Icaab2608 Offline
Member

Posts: 85
Threads: 37
Joined: Jul 2013
Reputation: 0
#1
Error expected method or property

When the launch his mod, I get here this error:[img][Image: bandicam20_4823027_15847164.jpg][/img]

PHP Code: (Select All)
const string BUTTONS_GO_TIMER "BUTTONS_GO_TIMER_CALLBACK"
 
 class 
ButtonsGo
    
{

            if(
event.KeyInput.PressedDown == true)
            {

                if (
event.KeyInput.Key==KEY_KEY_A)
                    
left=true;
                    {
                    
AddPropForce("barrel01_1"00300"World");
                    
AddPropImpulse("barrel01_1"005000"world");
                    }
                    
            if(
event.KeyInput.PressedDown == false)
            {

                if (
event.KeyInput.Key==KEY_KEY_A)
                    
left=false;
                    {
                    
AddPropForce("barrel01_1"00, -300"World");
                    
AddPropImpulse("barrel01_1"00, -5000"world");
                    }
                }

     }
     
     
ButtonsGo Buttons_obj_1;

void BUTTONS_GO_TIMER_CALLBACK(string &in timer_name)
    { 
Buttons_obj_1.Update(timer_name); } 
01-31-2015, 08:34 PM
Find Reply
Mudbill Offline
Muderator

Posts: 3,851
Threads: 59
Joined: Apr 2013
Reputation: 177
#2
RE: Error expected method or property

Could you explain more of what's going on here? Are you saying you're having a syntax issue with your script?

01-31-2015, 09:24 PM
Find Reply
Icaab2608 Offline
Member

Posts: 85
Threads: 37
Joined: Jul 2013
Reputation: 0
#3
RE: Error expected method or property

(01-31-2015, 09:24 PM)Mudbill Wrote: Could you explain more of what's going on here? Are you saying you're having a syntax issue with your script?
How do I know, can write completely your function on C++.I decided to write a function,that happening,during the interaction of keyboard keys (pressing and releasing).
01-31-2015, 10:20 PM
Find Reply
Mudbill Offline
Muderator

Posts: 3,851
Threads: 59
Joined: Apr 2013
Reputation: 177
#4
RE: Error expected method or property

I'm not sure if those native functions work for Amnesia. It's not C++ directly, it's AngelScript which is based on it. Even if the core engine uses those native functions, I don't think you can call them from the map's hps file. I might be wrong, but I have never seen anyone use it, so I assume there's a reason for that.

01-31-2015, 10:22 PM
Find Reply
Romulator Offline
Not Tech Support ;-)

Posts: 3,624
Threads: 62
Joined: Jan 2013
Reputation: 195
#5
RE: Error expected method or property

As far as I know, there is no way to use conditional key press queries in Amnesia. The only one you can do is F, which is of course, the Lantern, through SetLanternLitCallback(); and/or GetLanternActive();

That's all the information I can give though.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
02-01-2015, 12:22 AM
Find Reply
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#6
RE: Error expected method or property

Well, for one, you can't use C++ to write scripts for this game; Amnesia uses a scripting language called AngelScript.
Now, while AngelScript does support classes, there are some limitations, and the syntax is not the same as in C++. Finally, you have a bunch of syntax and logic errors. You can't just put an if-statement directly in a class - your class needs to have member functions, and you put executable code (like your if-statements) within these functions. Specifically, you probably intended to wrap these into the Update member function, since that's what you're calling on the object in the callback. But, there are other problems. You use symbols that are not defined for the game. Then, you have two blocks of code ("{ some_code }") that do not belong to anything, which may or may not be allowed in AngelScript (both under the if-statements with the single-line bodies):
PHP Code: (Select All)
if (event.KeyInput.Key==KEY_KEY_A)    // <---- the game doesn't know what any of these are
                    
left=false;    //  <---- the if-statement ends right here!
{
    
// any code here has nothing to do with the if-statement above


Also, BUTTONS_GO_TIMER_CALLBACK won't be called by anything, unless you somehow tell the game to do so (and when to do so).

Anyway, have you copied some of the code from a different game? Generally, code written for one game won't work at all with another - different games won't support the same things, and if they do, they will have different names and syntax for the same kins of functions, or they might use an altogether different. There's no cross-engine standardization of that sort.
(This post was last modified: 02-01-2015, 06:31 AM by TheGreatCthulhu.)
02-01-2015, 06:30 AM
Find Reply
Icaab2608 Offline
Member

Posts: 85
Threads: 37
Joined: Jul 2013
Reputation: 0
#7
RE: Error expected method or property

(02-01-2015, 06:30 AM)TheGreatCthulhu Wrote: Well, for one, you can't use C++ to write scripts for this game; Amnesia uses a scripting language called AngelScript.
Now, while AngelScript does support classes, there are some limitations, and the syntax is not the same as in C++. Finally, you have a bunch of syntax and logic errors. You can't just put an if-statement directly in a class - your class needs to have member functions, and you put executable code (like your if-statements) within these functions. Specifically, you probably intended to wrap these into the Update member function, since that's what you're calling on the object in the callback. But, there are other problems. You use symbols that are not defined for the game. Then, you have two blocks of code ("{ some_code }") that do not belong to anything, which may or may not be allowed in AngelScript (both under the if-statements with the single-line bodies):
PHP Code: (Select All)
if (event.KeyInput.Key==KEY_KEY_A)    // <---- the game doesn't know what any of these are
                    
left=false;    //  <---- the if-statement ends right here!
{
    
// any code here has nothing to do with the if-statement above


Also, BUTTONS_GO_TIMER_CALLBACK won't be called by anything, unless you somehow tell the game to do so (and when to do so).

Anyway, have you copied some of the code from a different game? Generally, code written for one game won't work at all with another - different games won't support the same things, and if they do, they will have different names and syntax for the same kins of functions, or they might use an altogether different. There's no cross-engine standardization of that sort.
That is, to use only C++?
02-01-2015, 11:33 AM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#8
RE: Error expected method or property

(02-01-2015, 11:33 AM)Icaab2608 Wrote:
(02-01-2015, 06:30 AM)TheGreatCthulhu Wrote: Well, for one, you can't use C++ to write scripts for this game; Amnesia uses a scripting language called AngelScript.
Now, while AngelScript does support classes, there are some limitations, and the syntax is not the same as in C++. Finally, you have a bunch of syntax and logic errors. You can't just put an if-statement directly in a class - your class needs to have member functions, and you put executable code (like your if-statements) within these functions. Specifically, you probably intended to wrap these into the Update member function, since that's what you're calling on the object in the callback. But, there are other problems. You use symbols that are not defined for the game. Then, you have two blocks of code ("{ some_code }") that do not belong to anything, which may or may not be allowed in AngelScript (both under the if-statements with the single-line bodies):
PHP Code: (Select All)
if (event.KeyInput.Key==KEY_KEY_A)    // <---- the game doesn't know what any of these are
                    
left=false;    //  <---- the if-statement ends right here!
{
    
// any code here has nothing to do with the if-statement above


Also, BUTTONS_GO_TIMER_CALLBACK won't be called by anything, unless you somehow tell the game to do so (and when to do so).

Anyway, have you copied some of the code from a different game? Generally, code written for one game won't work at all with another - different games won't support the same things, and if they do, they will have different names and syntax for the same kins of functions, or they might use an altogether different. There's no cross-engine standardization of that sort.
That is, to use only C++?

YOU CANNOT USE SOME C++ STUFF

"Veni, vidi, vici."
"I came, I saw, I conquered."
02-01-2015, 11:40 AM
Find Reply
Mudbill Offline
Muderator

Posts: 3,851
Threads: 59
Joined: Apr 2013
Reputation: 177
#9
RE: Error expected method or property

The general syntax is the only real similarity to C++. Otherwise, stick to Amnesia compatible code.

02-01-2015, 03:17 PM
Find Reply
Icaab2608 Offline
Member

Posts: 85
Threads: 37
Joined: Jul 2013
Reputation: 0
#10
RE: Error expected method or property

(02-01-2015, 03:17 PM)Mudbill Wrote: The general syntax is the only real similarity to C++. Otherwise, stick to Amnesia compatible code.
And this approach?
PHP Code: (Select All)
#include <iostream>
#include <conio.h>
int main()
{
    
using namespace std;
    
char x;
    
getch();
    switch (
getch()) //перед этим было switch(x)
    
{
    case 
72:
        
cout << "Up" << endl;
        break;
    case 
80:
        
cout << "Down" << endl;
        break;
    case 
75:
        
cout << "Left" << endl;
        break;
    case 
77:
        
cout << "Right" << endl;
        break;
    }
    return 
0;

(This post was last modified: 02-01-2015, 10:19 PM by Icaab2608.)
02-01-2015, 10:18 PM
Find Reply




Users browsing this thread: 1 Guest(s)