Comments (4)
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;
from plugin-sdk.
Thanks for the quick reply.
I have a special use case where wrapper functions are automatically generated for opcodes.
Can I use hex-numbers instead of opcode names? E.g.
ScriptCommand< 0x00AA >(PlayerCar, &CoordX, &CoordY, &CoordZ);
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){
SCMwrapper.PushInt(actHandle1, true);
SCMwrapper.PushFloat(varX2, true);
SCMwrapper.PushFloat(varY3, true);
SCMwrapper.PushFloat(varZ4, true);
copyThreadAttrToWrapper(curThread, SCMwrapper, (curThread->notFlag? 0x80A0: 0x00A0));
cmdResult = SCMwrapper.CallCommand(curThread->notFlag? 0x80A0: 0x00A0);
copyWrapperToThread(SCMwrapper, curThread);
SCMwrapper.SaveReturnedValues(retVal);
varX2 = varX(retVal.returnedValues[1].Float);
varY3 = varY(retVal.returnedValues[2].Float);
varZ4 = varZ(retVal.returnedValues[3].Float);
}
The easiest for me would be if fastman's SCMwrapper API would be added back.
from plugin-sdk.
Can I use hex-numbers instead of opcode names?
Yes.
Do I need the "Events::processScriptsEvent += [] {...}" to call an opcode and what does it mean?
It's recommended to 'call' opcodes when scripts are 'processed' (i.e. executed). That's why processScriptsEvent event is used in this example.
How do I pass the thread-pointer to the ScriptCommand?
Not possible yet.
from plugin-sdk.
I have copied this thread here: http://gtaforums.com/topic/838490-cleo-plugin-how-to-call-an-opcode-within-a-cleo-plugin/?p=1069733231
because I don't know where to find again it when the issue is closed.
from plugin-sdk.
Related Issues (20)
- The link for the eblip colors in CRadar.h doesn't work anymore. HOT 2
- tColLighting is wrong
- Error while compiling script (C3861 'M_PI': identifier not found) [Visual Studio 2019] HOT 3
- Error while building HOT 1
- injector::MakeInline modifies the EFLAGS register HOT 1
- Can't build plugin.sln (C2760 Error) [Visual Studio 2019 Community]
- Crash when calling CPlaceable::GetAtDirection()
- Build errors caused by C/C++ preprocessor definitions HOT 1
- Is this error caused because a d3dx9 sdk installation is missing? HOT 2
- Plugin-SDK adaptable for GTA SA mobile version. HOT 1
- VSIX installer error in Visual Studio HOT 3
- GetD3DDevice not work correct
- Compilation error. Visual Studio 2019 HOT 4
- Linux crosscompilation: error due to includes with different casing than the file HOT 2
- GPS example broken due to missing type on GetD3DDevice template function HOT 1
- WN 11 ?? HOT 2
- Error in plugin gen HOT 5
- Recent error while trying to clone HOT 1
- Modifying shadow colors.
- CRoadBlocks::aScriptRoadBlocks address collision HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-sdk.