[DiscordArchive] That is good to know, I'll avoid sleep, at least while writing code
[DiscordArchive] That is good to know, I'll avoid sleep, at least while writing code
Archived author: jintao41 • Posted: 2022-11-05T11:33:12.344000+00:00
Original source
That is good to know, I'll avoid sleep, at least while writing code
If I understand the example above correctly, it registers the event of another function while being in a function that has not yet finished executing?
Archived author: Foe • Posted: 2022-11-05T11:35:27.744000+00:00
Original source
Kinda correct, RegisterEvent registers a timed event tied to an object, in this case the player object. So once it reaches that part of the function, it registers that another function should fire in 10ms once. The function is completed, so it does not wait for that timed event to happen, so execution of function 1 is complete by the time function 2 is triggered
Archived author: Foe • Posted: 2022-11-05T11:36:51.407000+00:00
Original source
You can also write the function code directly in the RegisterEvent method, but I'm on a phone so not going to provide an example of that right now
Archived author: jintao41 • Posted: 2022-11-05T11:41:02.433000+00:00
Original source
That explanation is very helpful and I think I understand, thank you. Well, head-first into trying and failing then
Archived author: Foe • Posted: 2022-11-05T11:41:45.875000+00:00
Original source
And use a lot of prints
Archived author: Foe • Posted: 2022-11-05T11:42:27.266000+00:00
Original source
Something else I like doing is declaring functions as part of a local table, then you don't have to worry about declaration order for function calls
Archived author: Foe • Posted: 2022-11-05T11:43:01.087000+00:00
Original source
local t = {}
function t.functionName()
Archived author: Foe • Posted: 2022-11-05T11:43:43.545000+00:00
Original source
If you call another function within that function it can be declared later or prior to the said function, as long as they are both part of that local table
Archived author: jintao41 • Posted: 2022-11-05T11:46:58.135000+00:00
Original source
Just for the record and because I can laugh about it, until I learned about print last week I used heal over time spells to see where the script stopped working
Archived author: jintao41 • Posted: 2022-11-05T11:47:29.359000+00:00
Original source
I will save that bit of useful information as well, thank you again. I think 55Honey told me that as well and I have seen one or two example scripts that use these