• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

What is JASS equivalent of (Name of the current trigger) from GUI?

Level 5
Joined
May 10, 2024
Messages
57
Hi.

1. I would like to pass the name of the trigger as an argument to custom function without creating variable like myVar = (Name of the current trigger) and myFunc(myVar). It should be myFunc((Name of the current trigger)).
2. Is it possible to get some kind of backtrace/callStack inside myFanc? Perhaps it is possible to get the name of the trigger inside of myFanc without passing it's name to function via argument.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Hi.

1. I would like to pass the name of the trigger as an argument to custom function without creating variable like myVar = (Name of the current trigger) and myFunc(myVar). It should be myFunc((Name of the current trigger)).
2. Is it possible to get some kind of backtrace/callStack inside myFanc? Perhaps it is possible to get the name of the trigger inside of myFanc without passing it's name to function via argument.
I believe your Triggers all have the prefix "gg_trg_"
  • Custom script: myFunc(gg_trg_NameGoesHere)
No idea if this works or not.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I don't think Uncle understood you, lol.

No, the functionality you want doesn't exist in WC3: a trigger running has no way to identify the functions it runs or automatically pass itself as an argument, and there is no function to return a trigger's name given its handle. A trigger can only identify itself by its handle id (an integer). They can be run manually via TriggerEvaluate, TriggerExecute, .evaluate(), and .execute(), but the triggeraction/triggercondition being run is not an object you can access in any way.

The variables Uncle suggested can be compared to GetTriggeringTrigger() to see if there is a match, but there's no way for you to print the name. You can print the handle id integer of the trigger and use that to compare/keep track of but that won't always be the same number in every test.
 
Top