• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ How to send extended opcodes from c++?

lexus21

Active Member
Joined
Dec 14, 2022
Messages
87
Reaction score
25
I have code in OTClientV8 that reads a value from a COM device.
I want to send this value to the server (tfs 1.4.2)
How to send extended opcodes from c++(OTCv8)? or
Maybe I should switch the value to lua and send extended opcodes from lua?
 
Last edited:
I use tfs 1.4.2 without modifications and it has built-in opcodes. What you mentioned is tfs v8. This means that I have to implement the code from TFS_v8 to my tfs 1.4.2?
Post automatically merged:

i use this code in otc_v8


CLIENT SIDE (OTC_v8 by otacademy)
C++:
/.../
g_logger.info(stdext::format("This is my output: %s", line));
ProtocolGame protocolGame;
protocolGame.sendExtendedOpcode(14, line);
/.../



SERVER SIDE (TFS 1.4.2)

in In data/creaturescript/creaturescript.xml

i have
<event type="extendedopcode" name="ExtendedOpcode" script="extendedopcode.lua" />
inside extendedopcode i have :

Lua:
print("OPCODES WORK")

function onExtendedOpcode(player, opcode, buffer)
    if opcode == 14 then
        -- otclient language
        print("hey")
    else
        -- other opcodes can be ignored, and the server will just work fine...
    end
end

and login.lua
Lua:
player:registerEvent("ExtendedOpcode")

and in OTC - terminal -
ERROR: Unable to send extended opcode 14, extended opcodes are not enabled on this server.
This is my output: 596

in TFS after launch:

/.../
Using LuaJIT 2.0.5
Loading lua libs
OPCODES WORK
OPCODES WORK
/.../

extended opcodes don't work - what is wrong?
Post automatically merged:


@Mateus Robeerto
I added these modifications to my tfs 1.4.2, still getting the error. Any advice
 
Last edited:
Little update.
I managed to send opcodes from OTCv8 using a module in lua to tfsv8.
So this code for sending opcodes dosen't
work
C++:
/.../
g_logger.info(stdext::format("This is my output: %s", line));
ProtocolGame protocolGame;
protocolGame.sendExtendedOpcode(14, line);
/.../
Post automatically merged:

update.
this code
C++:
ProtocolGame protocolGame;
protocolGame.sendExtendedOpcode(51, line);
throw error : ERROR: Unable to send extended opcode 51, extended opcodes are not enabled on this server.

this code crashing client:
C++:
g_game.getProtocolGame()->sendExtendedOpcode(51, line);


 
Last edited:
Back
Top