globally callable functions
Moderator: Cheaters
-
- Newcomer
- Posts: 16
- Joined: August 23rd, 2010, 5:24 pm
-
- Super Moderator
- Posts: 3197
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
- Been thanked: 1 time
Re: globally callable functions
you can call any function. as long as its above the function thats calling
example
[spoiler = NOT GOOD][/spoiler]
example
[spoiler = NOT GOOD]
Code: Select all
function x takes nothing returns nothing
call y()
endfunction
function y takes nothing returns nothing
...
endfunction
Spoiler for GOOD:
-
- Newcomer
- Posts: 16
- Joined: August 23rd, 2010, 5:24 pm
Re: globally callable functions
i know that part. and I think I found the solution.
I wanted a function to be callable from any other trigger. But the problem was that the trigger with the function to be called was always getting compiled at the end.
Solution: write function in the *.w3x object at the top of the listi n the Trigger editor. right?
I wanted a function to be callable from any other trigger. But the problem was that the trigger with the function to be called was always getting compiled at the end.
Solution: write function in the *.w3x object at the top of the listi n the Trigger editor. right?
-
- Super Moderator
- Posts: 3197
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
- Been thanked: 1 time
Re: globally callable functions
callable from any other trigger?
You know that triggers and functions arent the same right?
You know that triggers and functions arent the same right?
-
- Newcomer
- Posts: 16
- Joined: August 23rd, 2010, 5:24 pm
Re: globally callable functions
Yes. This is what happened in my case:
I have a function I want to be callable(functionA). I put functionA in a trigger(triggerA) converted into custom text. I had another function(FunctionB), which is in another trigger(triggerB), call functionA. Error accurse because triggerA is placed after triggerB in compilation.
So my question is mroe of like, how do I make world editor place the code in TriggerA before the code of TriggerB?
I have a function I want to be callable(functionA). I put functionA in a trigger(triggerA) converted into custom text. I had another function(FunctionB), which is in another trigger(triggerB), call functionA. Error accurse because triggerA is placed after triggerB in compilation.
So my question is mroe of like, how do I make world editor place the code in TriggerA before the code of TriggerB?
-
- Super Moderator
- Posts: 3197
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
- Been thanked: 1 time
Re: globally callable functions
I'm really having alot of trouble understanding what your trying to say =\
-
- Forum Spammer
- Posts: 610
- Joined: March 30th, 2009, 9:02 pm
Re: globally callable functions
just get ur map, open in MPQEditor or something
extract Warmap.j
find functionA/triggerA and functionB/triggerB and make sure A is before B
then save warmap.j
import warmap.j using the MPQ thing
extract Warmap.j
find functionA/triggerA and functionB/triggerB and make sure A is before B
then save warmap.j
import warmap.j using the MPQ thing
-
- Newcomer
- Posts: 16
- Joined: August 23rd, 2010, 5:24 pm
Re: globally callable functions
I'm sorry haxorico. Also, naturesfury got the idea of my problem. I did that. I was just wondering if there was another solution that can be done with using the editor only. I should alter the *.wct file too?(since it also holds the triggers)
-
- Forum Spammer
- Posts: 610
- Joined: March 30th, 2009, 9:02 pm
Re: globally callable functions
dont rly think trigger order matters...
think its more function order thats messing u up
cuase triggers dont call other triggers
triggers activate functions that call other functions
triggers can enable or run another trigger but it would be linked to another function so.....yea....
i think just making sure the function order is fine is good enuf
think its more function order thats messing u up
cuase triggers dont call other triggers
triggers activate functions that call other functions
triggers can enable or run another trigger but it would be linked to another function so.....yea....
i think just making sure the function order is fine is good enuf
-
- Newcomer
- Posts: 16
- Joined: August 23rd, 2010, 5:24 pm
Re: globally callable functions
yeah, what he said.
My problem basically is that WE doesn't compile the triggers in the order that they are organized. So I have to open the map with MPQ editor(or other programs like that) and edit the triggers.
to make it cleared. This is the layout:
but WE compiled it like this:
My problem basically is that WE doesn't compile the triggers in the order that they are organized. So I have to open the map with MPQ editor(or other programs like that) and edit the triggers.
to make it cleared. This is the layout:
Code: Select all
triggerA{
function y takes nothing returns nothing
endfunction
}
triggerB{
function x takes nothing returns nothing
call y()
endfunction
}
Code: Select all
function x takes nothing returns nothing
call y()
function y takes nothing returns nothing
endfunction