Skip to content
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

Make outputMessage::addRawString available in Lua #1218

Merged
merged 2 commits into from
Sep 14, 2024

Conversation

divinity76
Copy link
Contributor

Why write

msg:addU8(1);
msg:addU8(0);
msg:addU8(113);

when you can instead write

msg:addRawString("\x01\x00\x71");

? Would make some lua scripts much easier to write :)

Why write
```lua
msg:addU8(1);
msg:addU8(0);
msg:addU8(113);
```
when you can instead write
```lua
msg:addRawString("\x01\x00\x71");
```
? Would make some lua scripts much easier to write :)
@diath
Copy link
Collaborator

diath commented Sep 14, 2024

Sure, I've also personally had some use for such functionality in the past.

@diath diath merged commit dab86e6 into edubart:master Sep 14, 2024
4 of 10 checks passed
@divinity76
Copy link
Contributor Author

divinity76 commented Sep 14, 2024

@diath porting BlackD Proxy scripts like

# your open bp #1 must be your main bp. open bp #2 must be your manarune bp.
# set _i to how many you want to buy.
fastExiva _i=20
:startcount
sayMessage exura "{$_i$}
sayMessage exura "bp manarune
#move bbp from container #1 pos #2 to container #2 pos #1:
fastExiva >>0F 00 78 FF FF 40 00 01 38 0B 01 FF FF 41 00 00 01 
#open bbp from container #2 pos #1:
fastExiva >>0A 00 82 FF FF 41 00 00 38 0B 00 01 
#move manarune from container #2 pos #1 to container #1 pos #1
#fastExiva >>0F 00 78 FF FF 41 00 00 81 0C 00 FF FF 40 00 00 01 
#move manarune from container #2 spot #1 to floor under yourself
fastExiva >>0F 00 78 FF FF 41 00 00 81 0C 00 E6 03 6D 04 07 01 
:dev2
:dev
#gotoScriptLine $nlineoflabel:dev$
fastExiva _i={$numericalexp:{$_i$}-1$}
IfTrue ($_i$#number>#0) Goto $nlineoflabel:startcount$
gotoScriptLine 9999

to otclient is not fun without it! xD
becomes stuff like

    local msg = OutputMessage.create()
    msg:addU8(15)
    msg:addU8(0)
    msg:addU8(120)
    msg:addU8(255)
    msg:addU8(255)
    msg:addU8(65)
    msg:addU8(0)
    msg:addU8(0)
    msg:addU8(129)
    msg:addU8(12)
    msg:addU8(0)
    msg:addU8(230)
    msg:addU8(3)
    msg:addU8(109)
    msg:addU8(4)
    msg:addU8(7)
    msg:addU8(1)
    g_game.getProtocolGame().send(msg)

instead of

    local msg = OutputMessage.create()
    msg:addRawString("\x0F\x00\x78\xFF\xFF\x41\x00\x00\x81\x0C\x00\xE6\x03\x6D\x04\x07\x01")
    g_game.getProtocolGame().send(msg)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants