View previous topic :: View next topic |
Author |
Message |
Twistedfate Expert Cheater
Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Mon Aug 08, 2016 2:10 pm Post subject: Add Delay or sleep to my script (help request ) |
|
|
I want my script sleep for 10 mil seconds can u add the sleep to the script please ( sleep - delay - disable then enable it self )
Code: |
[Enable]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem:
push ecx
mov ecx,#3435647439
cmp [esi+160], ecx
je originalcode
cmp [esi+24],#111
je originalcode
cmp [esi+24],#110
je originalcode
cmp [esi+24],#121
je originalcode
cmp [esi+24],#120
je originalcode
cmp [esi+24],#130
jne originalcode
fimul [esi+20]
mov [esi+20],#0
fdiv qword ptr [roleview.dll+1F3A0]
jmp exit
originalcode:
fimul [esi+20]
fdiv qword ptr [roleview.dll+1F3A0]
exit:
pop ecx
jmp returnhere
"roleview.dll"+21B0:
jmp newmem
nop
nop
nop
nop
returnhere:
[Disable]
dealloc(newmem)
"roleview.dll"+21B0:
fimul [esi+20]
fdiv qword ptr [roleview.dll+1F3A0]
|
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4697
|
Posted: Mon Aug 08, 2016 3:37 pm Post subject: |
|
|
A very literal interpretation of what you said:
Code: | ...
newmem:
push #10
call kernel32.Sleep
... |
Another interpretation that's probably a bit closer to what you want:
Code: | local rec = getAddressList().getMemoryRecordByDescription("whatever")
sleep(10)
rec.Active = false
rec.Active = true |
I wouldn't recommend directly integrating this Lua code into the AA script (make another thread do it if needed).
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Twistedfate Expert Cheater
Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Mon Aug 08, 2016 3:52 pm Post subject: |
|
|
Quote: | very literal interpretation of what you said |
Sry for my bad English
What I want :
the script run for 10 mil sec then the game normal code run the the script run again . which one could i use ?
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4697
|
Posted: Mon Aug 08, 2016 4:02 pm Post subject: |
|
|
Your English isn't the problem; it's that you didn't give much information.
Do you want the script to infinitely disable and enable itself?
How long do you want the game to run the original code for?
The second example I posted is closer to what you want, but again, you shouldn't put that in the script directly (I don't know what CE would do). Creating another thread to do that would be safer.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Twistedfate Expert Cheater
Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Mon Aug 08, 2016 4:19 pm Post subject: |
|
|
Quote: | Do you want the script to infinitely disable and enable itself?
|
Yes
Quote: | How long do you want the game to run the original code for? |
always except the 10mil sec when my script run .
Quote: | The second example |
How can I but it in my code or give me example of thread and thank you ^^
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4697
|
|
Back to top |
|
 |
Twistedfate Expert Cheater
Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Mon Aug 08, 2016 5:29 pm Post subject: |
|
|
Thank you I did it its cooooooooooooooool man
I pasted it in the script upper part and renamed( what ever )with script name
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Aug 08, 2016 6:08 pm Post subject: |
|
|
There a reason you didn't just go with a Lua timer?
Code: | {$lua}
[ENABLE]
myrecord = getAddressList().getMemoryRecordByDescription("whatever")
if mytimer == nil then
mytimer = createTimer(nil, false)
end
mytimer.Interval = 10
mytimer.OnTimer = function(timer)
myrecord.Active = not myrecord.Active
end
mytimer.Enabled = true
[DISABLE]
mytimer.Enabled = false |
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4697
|
Posted: Mon Aug 08, 2016 6:20 pm Post subject: |
|
|
Because he originally wanted it in that AA script, and using a timer directly in the [ENABLE] section would entail stuff I didn't want to have to explain.
Also, the GUI becomes unresponsive if you call sleep from the main thread. It's nearly unnoticeable if you set the timer's interval to 1000 and sleep for 10 (OP edited previous post; delay between reactivating is 1000), but it's still not a good habit. Disregarding that, however, I absolutely would use a timer in the Lua script window or in another script.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Aug 08, 2016 6:28 pm Post subject: |
|
|
No, you definitely wouldn't call sleep at all.
You'd use the timer itself to handle both enable/disable of the secondary script.
If you want different intervals, you can change them within the function too.
Code: | if myrecord.Active then
myrecord.Active = false
mytimer.Interval = 1000
else
myrecord.Active = true
mytimer.Interval = 10
end |
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4697
|
Posted: Mon Aug 08, 2016 6:33 pm Post subject: |
|
|
True. I never thought of changing the interval from within the OnTimer function.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
|