globally callable functions

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

TheJakal
Newcomer
Posts: 16
Joined: August 23rd, 2010, 5:24 pm

globally callable functions

Post by TheJakal »

Is there a way to make a function callable from any trigger?
User avatar
haxorico
Super Moderator
Posts: 3197
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Been thanked: 1 time

Re: globally callable functions

Post by haxorico »

you can call any function. as long as its above the function thats calling
example
[spoiler = NOT GOOD]

Code: Select all

function x takes nothing returns nothing
call y()
endfunction

function y takes nothing returns nothing
...
endfunction
[/spoiler]
Spoiler for GOOD:

Code: Select all

function x takes nothing returns nothing
...
endfunction

function y takes nothing returns nothing
call x
endfunction
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac: 

Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).

Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
TheJakal
Newcomer
Posts: 16
Joined: August 23rd, 2010, 5:24 pm

Re: globally callable functions

Post by TheJakal »

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?
User avatar
haxorico
Super Moderator
Posts: 3197
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Been thanked: 1 time

Re: globally callable functions

Post by haxorico »

callable from any other trigger?
You know that triggers and functions arent the same right?
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac: 

Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).

Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
TheJakal
Newcomer
Posts: 16
Joined: August 23rd, 2010, 5:24 pm

Re: globally callable functions

Post by TheJakal »

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?
User avatar
haxorico
Super Moderator
Posts: 3197
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Been thanked: 1 time

Re: globally callable functions

Post by haxorico »

I'm really having alot of trouble understanding what your trying to say =\
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac: 

Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).

Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: globally callable functions

Post by naturesfury »

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
TheJakal
Newcomer
Posts: 16
Joined: August 23rd, 2010, 5:24 pm

Re: globally callable functions

Post by TheJakal »

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)
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: globally callable functions

Post by naturesfury »

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
TheJakal
Newcomer
Posts: 16
Joined: August 23rd, 2010, 5:24 pm

Re: globally callable functions

Post by TheJakal »

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:

Code: Select all

triggerA{
function y takes nothing returns nothing
endfunction
}

triggerB{
function x takes nothing returns nothing
call y()
endfunction
}
but WE compiled it like this:

Code: Select all

function x takes nothing returns nothing
call y()

function y takes nothing returns nothing
endfunction