You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: functions/Event/addEventHandler.yaml
+12-13Lines changed: 12 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ shared:
12
12
and numerals)**'
13
13
- name: attachedTo
14
14
type: element
15
-
description: The [element](/reference/Element "Element") you wish to attach the handler to. The handler will only
15
+
description: The [[element]] you wish to attach the handler to. The handler will only
16
16
be called when the event it is attached to is triggered for this element, or
17
17
one of its children. Often, this can be the root element (meaning the handler
18
18
will be called when the event is triggered for *any* element).
@@ -45,22 +45,14 @@ shared:
45
45
description: Returns **true** if the event handler was attached successfully. otherwise **false** if the specified event could not be found or any parameters were invalid.
46
46
notes:
47
47
- type: info
48
-
content: You shouldn't re-use the same name for your handler function as the event
48
+
content: |
49
+
- You shouldn't re-use the same name for your handler function as the event
49
50
name - if multiple handler functions are used, as this can lead to confusion.
50
51
On the same note, for multiple reasons, it isn't a good idea to export the same
51
52
functions that you use locally as remote event handlers.
52
-
- type: info
53
-
content: See [Event Source Element](/reference/Event_Source_Element "Event Source Element") for a descriptive visualization of the event
53
+
- See [Event Source Element](/reference/Event_Source_Element "Event Source Element") for a descriptive visualization of the event
54
54
system handling an event trigger.
55
-
- type: important
56
-
content: See [Script security](/Script_security "Script security") for how-to prevent cheaters from abusing [event system](/reference/Event_System "Event system").
57
-
- type: important
58
-
content: Anything bound to a specific element will be run before other handlers
59
-
that are bound to something higher in the element tree (like root) This means
60
-
that "high+10" bound to root **won't** trigger before "normal" bound directly to
61
-
an element.
62
-
- type: info
63
-
content: Due to the additional set of global variables, the event-trigger specific
55
+
- Due to the additional set of global variables, the event-trigger specific
64
56
variables it is NOT a good idea to use the same function locally as well as
65
57
directly as an event handler . Event handlers often make use of the source element
66
58
variable which would often find no use in generic functions. Inside of server-side
@@ -70,3 +62,10 @@ shared:
70
62
the same issues. It is recommended to adapt a good-natured distancing principle
71
63
between code meant to run from local logic in separation to code meant to run
72
64
from remote logic.
65
+
- type: important
66
+
content: |
67
+
- See [Script security](/Script_security "Script security") for how-to prevent cheaters from abusing [event system](/reference/Event_System "Event system").
68
+
- Anything bound to a specific element will be run before other handlers
69
+
that are bound to something higher in the element tree (like root) This means
70
+
that "high+10" bound to root **won't** trigger before "normal" bound directly to
Copy file name to clipboardExpand all lines: functions/Event/triggerClientEvent.yaml
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -47,14 +47,14 @@ server:
47
47
content: It is marginally more efficient to pass one large event than two smaller
48
48
ones.
49
49
- type: important
50
-
content: Non-element MTA data types like [xmlNodes](/reference/xmlnode "XML Node") or resource pointers will not
50
+
content: |
51
+
- Non-element MTA data types like [xmlNodes](/reference/xmlnode "XML Node") or resource pointers will not
51
52
be able to be passed as they do not necessarily have a valid representation
52
53
on the client.
53
-
- type: important
54
-
content: To save client CPU, you should avoid setting theElement to the [root](/reference/root "Root") element
54
+
- To save client CPU, you should avoid setting theElement to the [root](/reference/root "Root") element
55
55
where possible - it should be used as a last resort (rather questionable thing
56
56
to do, limited to very specific tasks, if any). Using target element ( [player](/reference/player "Player")
57
57
who should receive event, if expected to be delivered to particular one) is
58
58
preferred and highly advisable. [resourceRoot](/reference/resourceRoot "ResourceRoot") can also be used as alternative
59
59
choice, if [addEventHandler](/reference/addEventHandler "addEventHandler") is bound to [root](/reference/root "Root") element, or to [resourceRoot](/reference/resourceRoot "ResourceRoot") when
60
-
there is need to restrict event to single certain resource.
60
+
there is need to restrict event to single certain resource.
Copy file name to clipboardExpand all lines: functions/Event/triggerEvent.yaml
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
shared:
2
2
name: triggerEvent
3
3
description: This function will trigger a named [event](/reference/Event_System "Event") on
4
-
a specific [element](/reference/Element "Element") in the [element tree](/reference/Element_tree
4
+
a specific [[element]] in the [element tree](/reference/Element_tree
5
5
"Element tree"). See [event system](/reference/Event_System "Event System") for more
6
6
information on how the event system works.
7
7
You can use the value returned from this function to determine if the event was cancelled by one of the event handlers. You should determine what your response (if any) to this should be based on the event's purpose. Generally, cancelling an event should prevent any further code being run that is dependent on whatever triggered that event. For example, if you have an onFlagCapture event, cancelling it would be expected to prevent the flag being able to be captured. Similarly, if you have onPlayerKill as an event you trigger, canceling it would either be expected to prevent the player being killed from dying or at least prevent the player from getting a score for it.
@@ -30,10 +30,10 @@ shared:
30
30
31
31
notes:
32
32
- type: info
33
-
content: You should avoid triggering events on the [root](/reference/root "Root") element unless you really
33
+
content: |
34
+
- You should avoid triggering events on the [root](/reference/root "Root") element unless you really
34
35
need to. Doing this triggers the event on every element in the element tree,
35
36
which is potentially very CPU intensive. Use as specific (i.e. low down the
36
37
tree) element as you can.
37
-
- type: info
38
-
content: See [Event Source Element](/reference/Event_Source_Element "Event Source Element") for a descriptive visualization of the event
38
+
- See [Event Source Element](/reference/Event_Source_Element "Event Source Element") for a descriptive visualization of the event
0 commit comments