View previous topic :: View next topic |
Author |
Message |
Frouk Master Cheater Reputation: 5
Joined: 22 Jun 2021 Posts: 489 Location: mov dword ptr [Ukraine]
|
Posted: Mon Aug 30, 2021 7:07 am Post subject: function local value |
|
|
Code: | function new(minValue,maxValue,timer)
end
|
How to use those local values and set them into a value without calling function like this: function new(10,50)[/code]
_________________
void(__cdecl *Haxing)(HWND hGameWindow) |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Mon Aug 30, 2021 10:42 am Post subject: |
|
|
In the function declare the base value
Code: |
function new(minValue,maxValue,timer)
local minValue = 10
local maxValue = 50
...
end
|
|
|
Back to top |
|
|
Frouk Master Cheater Reputation: 5
Joined: 22 Jun 2021 Posts: 489 Location: mov dword ptr [Ukraine]
|
Posted: Mon Aug 30, 2021 10:45 am Post subject: |
|
|
can you give me an example of timer? (idk, how to create one if stored in function)
_________________
void(__cdecl *Haxing)(HWND hGameWindow) |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Mon Aug 30, 2021 11:03 am Post subject: |
|
|
Code: |
function startCounter(init)
local uniqueToThisScript=init
local repeatingTimer=createTimer(getApplication())
repeatingTimer.Interval=10
repeatingTimer.OnTimer=function(t)
uniqueToThisScript=uniqueToThisScript+1
end
createTimer(2000,function(t)
repeatingTimer.destroy()
print("After 2 seconds the value is "..uniqueToThisScript)
end)
end
startCounter(0)
startCounter(1000)
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Frouk Master Cheater Reputation: 5
Joined: 22 Jun 2021 Posts: 489 Location: mov dword ptr [Ukraine]
|
Posted: Mon Aug 30, 2021 12:55 pm Post subject: |
|
|
Thanks LeFiXER and Dark Byte
_________________
void(__cdecl *Haxing)(HWND hGameWindow) |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Mon Aug 30, 2021 2:57 pm Post subject: |
|
|
You're welcome but I feel DB is more deserving of your gratitude as he was able to provide a better solution.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
Posted: Tue Aug 31, 2021 1:26 am Post subject: |
|
|
If you are looking to do default values based on the params passed, you can do things like this as well:
Code: |
local function new(minVal, maxVal, timer)
minVal = minVal or 10;
maxVal = maxVal or 50;
print(string.format('min: %d, max: %d', minVal, maxVal));
end
new(100, 500);
new();
|
_________________
- Retired. |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Tue Aug 31, 2021 2:54 am Post subject: |
|
|
I had not considered using logic to determine whether the values are different from pre-defined values. Thanks for the tip atom0s.
|
|
Back to top |
|
|
|