How do I....?

Memory scanning, code injection, debugger internals and other gamemodding related discussion
Post Reply
Sigan
Expert Cheater
Expert Cheater
Posts: 267
Joined: Fri May 26, 2017 1:23 am
Reputation: 125

How do I....?

Post by Sigan »

I'm trying to make a script that changes my equipped weapon upon accessing a certain address. The question I have is, how would I create something like a drop-down list, or a specific, typed-in value, that will only be injected upon the script being called?

So, an axe is equipped, but upon refreshing the screen, I want it to equip a sword. I know the IDs for both, the sword and the axe, but changing either one at the specific pointer will cause a crash. Having it change upon refresh may not. I need to create a variable that I can change and the script can then call on it.

I know how to use globalalloc() to create a variable that can be called upon to access a pointer at an offset, so that the table can give access to a pointer for manipulation directly or for troubleshooting/testing. I know how to use label() to create a variable that can be turned on or off, like:

Code: Select all

[Enable]
...
label(infPoints)
...
  cmp [infPoints],1
  jne @f
  ...
@@:
...
infPoints:
  dd 0
...
registersymbol(infPoints)
[Disable]
unregistersymbol(infPoints)
Then, separately:

Code: Select all

[Enable]
infPoints:
  dd 1
[Disable]
  dd 0
Enabling infPoints on ticking the box will allow the script to not jump to the end, and will inject my script. Prior to that, just activating the initial script will do nothing. However, with a globalalloc() at the top, I can call on the pointer in a separate line as well.

I just wish I could write in a value, then have the script check that value when it's called upon. Something like:

Code: Select all

...
  cmp [chgWeap],1
  jne @f
  mov [eax],[var]
  chgWeap:
    dd 0
 @@:
 ...
I know how to move a value into a variable, I just did that last part for explanation of what I'm going for, in case I haven't been clear enough. Any help is appreciated. Thank you.

Sigan
Expert Cheater
Expert Cheater
Posts: 267
Joined: Fri May 26, 2017 1:23 am
Reputation: 125

Re: How do I....?

Post by Sigan »

Am I asking this in the wrong place, or are the serious scripters just not responding to things like this? I mean, I kinda understand... I tend to write my tables, post them, then start a different table. Just hoping to get the attention of someone that really knows what they're doing, and what I'm trying to do.

If you don't know how to help me with how to write the code, could you point me to a forum or place where I can get that help? Thank you.

User avatar
kantoboy69
Expert Cheater
Expert Cheater
Posts: 90
Joined: Fri Aug 30, 2019 5:33 am
Reputation: 50

Re: How do I....?

Post by kantoboy69 »

allocate memory for your items
alloc(myitems, $100)
alloc(myselecteditem, 4)
registersymbol(myitems)
registersymbol(myselecteditem)

// assuming save a set of two items and address is 32bit

myitems:
dd 00 00 00 00 // just to initialize some part of it

myitems+0 = sword1
myitems+4 = shield 1

myitems+8 = sword2
myitems+A = shield 2

myitems+C = sword3
myitems+10 = shield 3

So on drop down just have 0, 8, c as index for set1 set2 set3
so in theory when you set it to set 2 which is 8
then fetch myitems+myselecteditem for sword 2 and myitems+myselecteditem+4 for shield 2
Last edited by kantoboy69 on Tue May 12, 2020 7:31 pm, edited 1 time in total.

Sigan
Expert Cheater
Expert Cheater
Posts: 267
Joined: Fri May 26, 2017 1:23 am
Reputation: 125

Re: How do I....?

Post by Sigan »

Thanks for the response :) I appreciate that.

Post Reply

Who is online

Users browsing this forum: No registered users