Icaab2608
Member
Posts: 85
Threads: 37
Joined: Jul 2013
Reputation:
0
|
Error expected method or property
When the launch his mod, I get here this error:[img] [/img]
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", 0, 0, 300, "World"); AddPropImpulse("barrel01_1", 0, 0, 5000, "world"); } if(event.KeyInput.PressedDown == false) {
if (event.KeyInput.Key==KEY_KEY_A) left=false; { AddPropForce("barrel01_1", 0, 0, -300, "World"); AddPropImpulse("barrel01_1", 0, 0, -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 |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
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 |
|
Icaab2608
Member
Posts: 85
Threads: 37
Joined: Jul 2013
Reputation:
0
|
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 |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
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 |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
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
|
|
02-01-2015, 12:22 AM |
|
TheGreatCthulhu
Member
Posts: 213
Threads: 10
Joined: Oct 2010
Reputation:
32
|
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):
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.
|
|
02-01-2015, 06:30 AM |
|
Icaab2608
Member
Posts: 85
Threads: 37
Joined: Jul 2013
Reputation:
0
|
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):
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 |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
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):
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 |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
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 |
|
Icaab2608
Member
Posts: 85
Threads: 37
Joined: Jul 2013
Reputation:
0
|
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?
#include <iostream> #include <conio.h> int main() { using namespace std; char x; 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 |
|
|