Forums WoW Modding Support Archives Azerothcore Discord Archives [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

[DiscordArchive] That is good to know, I'll avoid sleep, at least while writing code

Pages (2): 1 2 Next
rektbyfaith
Administrator
0
11-05-2022, 11:33 AM
#1
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?
rektbyfaith
11-05-2022, 11:33 AM #1

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?

rektbyfaith
Administrator
0
11-05-2022, 11:35 AM
#2
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
rektbyfaith
11-05-2022, 11:35 AM #2

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

rektbyfaith
Administrator
0
11-05-2022, 11:36 AM
#3
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
rektbyfaith
11-05-2022, 11:36 AM #3

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

rektbyfaith
Administrator
0
11-05-2022, 11:41 AM
#4
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
rektbyfaith
11-05-2022, 11:41 AM #4

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

rektbyfaith
Administrator
0
11-05-2022, 11:41 AM
#5
Archived author: Foe • Posted: 2022-11-05T11:41:45.875000+00:00
Original source

And use a lot of prints
rektbyfaith
11-05-2022, 11:41 AM #5

Archived author: Foe • Posted: 2022-11-05T11:41:45.875000+00:00
Original source

And use a lot of prints

rektbyfaith
Administrator
0
11-05-2022, 11:42 AM
#6
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
rektbyfaith
11-05-2022, 11:42 AM #6

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

rektbyfaith
Administrator
0
11-05-2022, 11:43 AM
#7
Archived author: Foe • Posted: 2022-11-05T11:43:01.087000+00:00
Original source

local t = {}
function t.functionName()
rektbyfaith
11-05-2022, 11:43 AM #7

Archived author: Foe • Posted: 2022-11-05T11:43:01.087000+00:00
Original source

local t = {}
function t.functionName()

rektbyfaith
Administrator
0
11-05-2022, 11:43 AM
#8
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
rektbyfaith
11-05-2022, 11:43 AM #8

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

rektbyfaith
Administrator
0
11-05-2022, 11:46 AM
#9
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
rektbyfaith
11-05-2022, 11:46 AM #9

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

rektbyfaith
Administrator
0
11-05-2022, 11:47 AM
#10
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
rektbyfaith
11-05-2022, 11:47 AM #10

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

Pages (2): 1 2 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)