| 06-16-2003, 09:01 PM | #1 |
After having seen the response in these threads "Jass Tutorial" http://www.wc3campaigns.com/forums/s...212#post180212 "Jass/AI tutorial/school" http://www.wc3campaigns.com/forums/s...threadid=19212 I have decided to create a tutorial on Jass for non-programmers. What's left, except writing the tutorial, is to decide on the exact content. Please help me to do this by answering this poll. Thank you! |
| 06-18-2003, 04:19 PM | #2 |
Well, since you asked for it, we will begin with creating the well-known Hello World program, trigger version. The purpose of this lesson is that WC shall print "Hello, World!" when it starts the used map. This is done by creating a trigger which runs on map initialisation, which you should know already since you are supposed to know a few things about triggers. ;) I suggest that you start up your WE and start with creating this trigger the normal (gui) way. When you are done with that select you trigger, open the file-menu and choose "Convert to custom text". It will ask you if you are really sure, and you will happily answer Yes! When you've done that please post your code here and I'll explain what the code means. Before you post your code you should also make sure that it does what it is supposed to, so save your map and try it. |
| 06-23-2003, 04:24 PM | #3 |
Well, maybe some of you are to shy to post your code... so I'll post 3 examples doing the same thing myself. Pretty much produced by the WE (shows text for 30sec): Code:
function Trig_Hello3_Actions takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 30, "Hello, World!" )
endfunction
//===========================================================================
function InitTrig_Hello3 takes nothing returns nothing
set gg_trg_Hello3 = CreateTrigger( )
call TriggerAddAction( gg_trg_Hello3, function Trig_Hello3_Actions )
endfunctionAnother way to display text to user: Code:
function HelloWorld takes nothing returns nothing
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Hello, World!")
endfunction
//===========================================================================
function InitTrig_HelloWorld takes nothing returns nothing
set gg_trg_HelloWorld = CreateTrigger( )
call TriggerAddAction( gg_trg_HelloWorld, function HelloWorld )
endfunctionAnd last, my favourite (shown for an hour): Code:
function InitTrig_Hello2 takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 3600, "Hello, World!")
endfunctionAny thoughts or questions on any of the three code examples? |
