• 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.

Cannot convert codereturnsnoboolean to trigger

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
JASS:
        private static method talk2948 takes nothing returns nothing
       call TriggerRegisterPlayerChatEvent(function thistype.bypass2, Player(0), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(1), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(2), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(3), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(4), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(5), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(6), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(7), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(8), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(9), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(10), "-create", false )
       call TriggerRegisterPlayerChatEvent(bypass2, Player(11), "-create", false )
        endmethod
       private static method bypass2 takes nothing returns nothing
        endmethod

This is my trigger. Im trying to learn Jass and I'm just experimenting with some triggers. Player(1) to Player(11) return seperate errors, but once i get 0 working ill set them correctly. The line that has player(o) returns the error message in the title. How do i fix that?
 
The first argument that you have put is a code-type input (a function), not a trigger. ;) (the function expects a trigger)

You would have to do something like this:
JASS:
private static method talk2948 takes nothing returns nothing
    local trigger t = CreateTrigger() // since it expects a trigger argument, we'll create one
    call TriggerAddAction(t, function thistype.bypass2) // we will set this function as the trigger's actions
    call TriggerRegisterPlayerChatEvent(t, Player(0), "-create", false)
endmethod

Then it should parse without error. :)
 
Level 7
Joined
Apr 30, 2011
Messages
359
JASS:
// it's better to place this here, due for some reasons
private function onTalk takes nothing returns nothing
    // if in debug mode, all players will receive this message
    debug call BJDebugMsg("Created")
endfunction

private function Talk takes nothing returns nothing
    // those functions bellow needs a trigger to use
    // this will create a local variable
    // don't forget to create the trigger
    local trigger t = CreateTrigger()
    
    // now you'll using a loop,
    // but first, you need an integer variable to exit the loop
    local integer i = 0 // notice the variable's value (0)
    
    // let's start looping around
    loop
        exitwhen i == 12 // do this or wc3 will crash :p
        
        // register the trigger's event
        // this will be what you see in GUI
        call TriggerRegisterPlayerChatEvent(t, Player(i), "-create", false)
        
        // register the trigger's action
        // there's two way to do this
        // 1. using normal action
        call TriggerAddAction(t, function onTalk)
        
        // 2. abusing the condition thing
        // notice the use of Filter/Condition function
        // before you type function onTalk
        call TriggerAddCondition(t, Filter(function onTalk))
        
        // note that the action will run twice
        
        set i = i + 1 // don't forget to add this, or wc3 will crash
                      // because of this infinite loop
    endloop
endfunction

clear enough?
 
Status
Not open for further replies.
Top