• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] You can help me?

Status
Not open for further replies.
Level 11
Joined
Mar 27, 2011
Messages
293
Good Morning, afternoon or evening to you!

I'm studying JASS, and realize it's semlhante C + + (when it comes to functions, such as the function int main ()), wanted (if you can) to help me take some questions (me Corrigan if I'm wrong):


> I really need this function when I write a program in JASS?
JASS:
function Trig_Trigger_Actions takes nothing returns nothing
endfunction

> Sometimes, when I use the command line:
  • Custom script: call Hi()
JASS:
function Hi takes nothing returns nothing
	call DisplayTimedTextToForce( GetPlayersAll(), 30, "TRIGSTR_009" )
endunction

//===========================================================================
function InitTrig_Trigger takes nothing returns nothing
    set gg_trg_Trigger = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Trigger, function Trig_Trigger_Actions )
endfunction

My World Edit warns me that there are errors in the function. What did I do wrong?
 
Last edited:
Level 20
Joined
Aug 13, 2013
Messages
1,696
Add TriggerRegister to the init function let's say this event: call TriggerRegisterTimerEvent( gg_trg_JASS, 0.00, false ) This event in GUI is Time Elapsed in 0.00 seconds. Anyway you need to call Hi Function or set the TriggerAddAction to Hi. You need to put the HI function at the top of the Action to call a functions.
 
To do loops in JASS, you start off with the keywords loop and endloop:
JASS:
loop
   // looping actions
endloop
Then you need to specify an exit condition, otherwise it will do an infinite loop (unless you have a thread sleep function). You do this using exitwhen <condition>. The condition can really be anything, such as when a unit dies, when a number reaches another number, etc.. Let's make a simple example where you loop five times.
JASS:
local integer i = 1
loop
    exitwhen i > 5
    call BJDebugMsg(I2S(i))
    set i = i + 1
endloop
That will display 1, 2, 3, 4, 5. You may want to check out Deathismyfriend's tutorial since you are moving from GUI, or something like this:
http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/jass-what-func-238298/
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Sorry if this isn't relevant to the topic but:
JASS:
function Hi takes nothing returns nothing
    call DisplayTimedTextToForce( GetPlayersAll(), 30, "TRIGSTR_009" )
endunction

//===========================================================================
function InitTrig_Trigger takes nothing returns nothing
    set gg_trg_Trigger = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Trigger, function Hi)
endfunction
 
This function "loop" looks like:

  • For each (Integer A) from A to 10, do (Actions)
    • Loop - Actions
:vw_wtf:

Yeah. This:
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Game - Display "Hello" to (All Players) for 30.00 seconds
Is similar to doing:
JASS:
local integer i = 1
loop
    exitwhen i > 10
    call DisplayTimedTextToForce( GetPlayersAll(), 30, "Hello")
    set i = i + 1
endloop

----
And about the error, (1) you wrote endunction instead of endfunction.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
You can help me?

Seriously, what the fuck is the purpose of such a thread name. When you open a new thread in a mapping help forum you obviously need help with something. Next time chose a title that rougly tells what ur thread is about or il spam the moderators until the thread is deleted (hello meg!).
 
Status
Not open for further replies.
Top