HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

scopes + local triggers

01-23-2008, 08:05 PM#1
SockSquirrelMouthwash
I'm just experimenting with scopes and one thing I don't really understand is how to create local triggers under a scope. I got it to where I can do it with libraries with the initializer feature but with a scope I'm not sure what to do to make the trigger... create

This is my test trigger:
Collapse JASS:
scope Turdburglar

private function burgle takes nothing returns nothing
    call DisplayTimedTextToForce( GetPlayersAll(), 1, "TURDBURGLAR" )
endfunction

public function InitTrig takes nothing returns nothing
    local trigger burgletrig = CreateTrigger()
    call TriggerRegisterPlayerChatEvent( burgletrig, Player(0), "-burgle", true )
    call TriggerRegisterTimerEventSingle( burgletrig, 2 )
    call TriggerAddAction( burgletrig, function burgle )
endfunction
endscope

What do I add/subtract from the code to make it work when either of those two events are met?
01-23-2008, 09:40 PM#2
xombie
Your code looks all good and such, but InitTrig won't be called unless the trigger-script is actually named Turdburglar, this is the only thing I can see after a quick look but you should probably include what you want this code to do in the description.
01-23-2008, 09:59 PM#3
SockSquirrelMouthwash
Quote:
Originally Posted by xombie
Your code looks all good and such, but InitTrig won't be called unless the trigger-script is actually named Turdburglar, this is the only thing I can see after a quick look but you should probably include what you want this code to do in the description.

Do you mean I should create a new trigger via the gui button and name it, in this case for this example, InitTrig, and place the rest of the code in for it to fire off properly when the events are met?

I'm just trying to get the trigger to actually be created is all.
01-23-2008, 10:12 PM#4
xombie
Notice in the screenshot how the scope name is the same as the trigger-file name?
Attached Images
File type: jpgscrn.jpg (118.3 KB)
01-23-2008, 11:17 PM#5
SockSquirrelMouthwash
Quote:
Originally Posted by xombie
Notice in the screenshot how the scope name is the same as the trigger-file name?

Nice! Didn't notice that ... Thanks man!