Add event to scope trigger

JJooKKoo

New Member
Reaction score
0
Hi i read a tutorial that i must make my trigers with scope but when i wont to add event to this triger outside it how it can be done
 

DioD

New Member
Reaction score
57
compile code to get true names and use this names directly, in most cases SCOPE__NAME
 

SerraAvenger

Cuz I can
Reaction score
234
compile code to get true names and use this names directly, in most cases SCOPE__NAME

Ofc not.

What you do is a) make your trigger public and use [SCOPE NAME]_[TRIGGER NAME] b) Add functions to add events to the Trigger c) Add a function to get the trigger out of your Scope, eg public function GetMyTrigger takes nothing returns ... which you can later on use by [SCOPE NAME]_GetMyTrigger()

I'd probably choose c) unless you seriously have to restrict possible events in order to maintain consistency.
 

Bribe

vJass errors are legion
Reaction score
67
What are you trying to achieve? It is much easier to build everything in one scope.
 

DioD

New Member
Reaction score
57
false

Code:
// scope A begins

function A___B takes nothing returns nothing
endfunction

function A_f takes nothing returns nothing
endfunction

// scope A ends
==
Code:
scope A

private function B takes nothing returns nothing
endfunction

public function f takes nothing returns nothing
endfunction

endscope
 

Bribe

vJass errors are legion
Reaction score
67
Not in the event that it produces a double underscore instead of a triple underscore, which is randomised each save.
 

SerraAvenger

Cuz I can
Reaction score
234
doublefacepalm duo for jasshelped author, since this is not documented feature.

triplefacepalm.

1. Even if what you posted had worked, it would defy the very meaning of scope.
2. That you try to circumvent scopes shows how ignorant of design patterns you are. Please read a book about it (or two) and stop providing bad coding habits to fellow programmers.
3. Giving a facepalm to someone because you don't understand his genius and/or intentions is just worthy of a facepalm by itself.
 

tooltiperror

Super Moderator
Reaction score
231
For the OOP freaks like me, you can also use a struct and encapsulation instead.
 

DioD

New Member
Reaction score
57
3. Giving a facepalm to someone because you don't understand his genius and/or intentions is just worthy of a facepalm by itself.
well, explain it, i dont understand reasons to include undocumented features into tools.

personally, i dont understand fellow programmers who dont ever know results of code compilation.
 

Bribe

vJass errors are legion
Reaction score
67
Seeing how their code compiles would cause reasonable people to totally rethink their approach to programming. Trigger evaluations in the place of what you'd think would be simple calls, tons of wastefully generated text, a world of global variables you could never wrap your mind around.
 

SerraAvenger

Cuz I can
Reaction score
234
i dont understand reasons to include undocumented features into tools.

jasshelpermanual said:
the way private work is actually by automatically prefixing scopename(random digit)__ to the identifier names of the private members. The random digit is a way to let it be truly private so people can not even use them by adding the preffix themselves.
rtfm
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top