New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapper for opcodes is missing #34
Comments
|
It's possible to "call" an opcode in this way: #include "extensions\ScriptCommands.h"
using namespace plugin::test;
// ...
ScriptCommand<PRINT_NOW>("FEC_INC", 150, 1);#include "plugin_III.h"
#include "extensions\ScriptCommands.h"
using namespace plugin;
using namespace plugin::test;
class Gta3ScriptCommandsTest {
public:
Gta3ScriptCommandsTest() {
Events::processScriptsEvent += [] {
int PlayerChar, PlayerCar;
float CoordX, CoordY, CoordZ;
if (ScriptCommand<IS_PLAYER_PLAYING>(0))
{
ScriptCommand<GET_PLAYER_CHAR>(0, &PlayerChar);
if (ScriptCommand<IS_CHAR_IN_ANY_CAR>(PlayerChar))
{
ScriptCommand<STORE_CAR_CHAR_IS_IN_NO_SAVE>(PlayerChar, &PlayerCar);
ScriptCommand<GET_CAR_COORDINATES>(PlayerCar, &CoordX, &CoordY, &CoordZ);
ScriptCommand<DRAW_SHADOW>(3, CoordX, CoordY, CoordZ, 0.0f, 3.0f, 150, 255, 0, 0);
ScriptCommand<PRINT_NOW>("FEC_INC", 150, 1);
}
}
};
}
} test; |
|
Thanks for the quick reply. Can I use hex-numbers instead of opcode names? E.g. Do I need the "Events::processScriptsEvent += [] {...}" to call an opcode and what does it mean? I want the called opcode have the same effect on the current thread as a normal opcode would have. How do I pass the thread-pointer to the ScriptCommand? (or obtain a thread pointer if it has its own thread) In my code I have a function "copyThreadAttrToWrapper" that translates the state from the current thread to the fastman's SCMwrapper's thread and "copyWrapperToThread" to translate it back. Here is an example of what I mean: void op00A0(DWORD actHandle1, float& varX2, float& varY3, float& varZ4){ The easiest for me would be if fastman's SCMwrapper API would be added back. |
Yes.
It's recommended to 'call' opcodes when scripts are 'processed' (i.e. executed). That's why processScriptsEvent event is used in this example.
Not possible yet. |
|
I have copied this thread here: http://gtaforums.com/topic/838490-cleo-plugin-how-to-call-an-opcode-within-a-cleo-plugin/?p=1069733231 |
goodidea82 commentedJun 29, 2017
Some earlier version had a wrapper (SCMWrapper) for opcodes (developed by fastman92), but now the API is missing:
https://github.com/DK22Pac/plugin-sdk/blob/master/src/sdk/plugin/script/wrapper.h
This API is important for because I already have a lot of custom code that depend on it.
(Some background: http://gtaforums.com/topic/838490-cleo-plugin-how-to-call-an-opcode-within-a-cleo-plugin/?p=1068513051)
The text was updated successfully, but these errors were encountered: