(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Tutorials > JASS/AI Scripts Tutorials

JASS/AI Scripts Tutorials Contains tutorials regarding JASS scripting and the AI editor.
Read the Rules before posting.

Reply
 
LinkBack Thread Tools Display Modes
Old 08-21-2008, 02:49 PM   #91 (permalink)
 
Cheezeman's Avatar

User
 
Join Date: Aug 2008
Posts: 56

Cheezeman is an unknown quantity at this point (0)


Thumbs down This tutorial sucks...

This tutorial really sucks...
I can't even make the "simple trigger" to work.
I'm supposed to put the following text inside the map icon (called Untitled) on the "Custom Script Code:"
function HelloWorld takes nothing returns nothing
    call BJDebugMsg("Hello World")
endfunction

So I did...
Then I was suposed to create a trigger which went of by pressing Left Key and name it whatever I want. I was going to put the following text there, just as asked:
call HelloWorld()

BUT: There was already a text there:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
    call TriggerRegisterPlayerKeyEventBJ( gg_trg_Untitled_Trigger_001, Player(0), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_LEFT )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

And wherever I put it, it said that the trigger was wrong.
If I replaced it the Editor asked for a initzialation text...
If I placed it after the text, it said that it was wrong and would be disabled.



So my finnaly question/sugestion:

Could you post a picture or JASStag which shows
1: You selecting "Untitled" map icon?
2: You selecting the "Untitled Trigger 001" icon?

Oh yes and by the way Herman: I've read the rest and didn't understand a single thing about it, probobly due to that I didn't even make the 1th tutorial to work. Why move on to the next stage, if you are not finished with the first?

BTW I re-uploaded this "complination text" (wrong word, I know) beacuse I didn't find it on the Replies section.
Cheezeman is offline   Reply With Quote
Old 08-21-2008, 11:27 PM   #92 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Unless your dyslexic, please don't spell words wrong, or use incorrect words. I cannot tell what 'complination' is supposed to mean. My strongest guess is 'compilation', 2nd guess would be 'complaint'.

I meant read through the rest of it, because your supposed to stick it in a trigger and use it. Simply making the function will not do anything, as you had described.

When he says make a trigger, he is assuming your moving from GUI to JASS. You should not convert the trigger to custom text, in your events put a normal GUI event for 'Left Key', and put for 'Actions', find the 'Custom Script' and type in 'call HelloWorld()'

It should look somewhat like this...

Events
'Left Key Press'
Conditions
Actions
Custom Script: call HelloWorld()

And as for this tutorial sucks, don't blame the tutorial, there is such a thing as being stupid

I don't think your stupid though, I had the same problems with these tutorials, and really got quite pissed when I started. You just need to keep at it, try every possibility, and above all else being a lazy schmuck cannot help.
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 08-22-2008, 02:14 AM   #93 (permalink)
 
hawk900's Avatar

`
 
Join Date: May 2007
Posts: 2,216

hawk900 has disabled reputation


Quite framkly I think that it is a quality tutorial.

The answer, wuite simply is:

JASS is crap.


Sorry, to all you dedicated JASS'ers out there, but as a language it is quite frankly lame. Compared to something like Pytohn, or C it does not compare.

Still, I'm going to learn it, and it can do powerful things in Warcraft.
__________________
hawk900 is online now   Reply With Quote
Old 08-22-2008, 08:57 AM   #94 (permalink)
 
vercas's Avatar

The almighty Lich...
 
Join Date: Dec 2007
Posts: 1,185

vercas has little to show at this moment (56)


I know what my cat says better than a JASS trigger...
__________________
My dragons!

WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

(\__/)
(='.'=)
Spread the Emoticat!
WWWWWWWWWWWWWWWWWWWW
vercas is offline   Reply With Quote
Old 08-22-2008, 09:36 AM   #95 (permalink)

User
 
Join Date: Jan 2008
Posts: 11

Sam Panda is an unknown quantity at this point (0)


Thanks for the reply, herman, but the reason it's missing an endfunction in the shown code is because I only showed the relevant part to what I was talking about.

It still has an endfunction and everything, the only addition is one line that is correctly written and everything and I dunno why the lack of savability happens ;(
Sam Panda is offline   Reply With Quote
Old 08-22-2008, 02:51 PM   #96 (permalink)
 
Cheezeman's Avatar

User
 
Join Date: Aug 2008
Posts: 56

Cheezeman is an unknown quantity at this point (0)


Quote:
Originally Posted by Herman View Post
Unless your dyslexic, please don't spell words wrong, or use incorrect words. I cannot tell what 'complination' is supposed to mean. My strongest guess is 'compilation', 2nd guess would be 'complaint'.

I meant read through the rest of it, because your supposed to stick it in a trigger and use it. Simply making the function will not do anything, as you had described.

When he says make a trigger, he is assuming your moving from GUI to JASS. You should not convert the trigger to custom text, in your events put a normal GUI event for 'Left Key', and put for 'Actions', find the 'Custom Script' and type in 'call HelloWorld()'

It should look somewhat like this...

Events
'Left Key Press'
Conditions
Actions
Custom Script: call HelloWorld()

And as for this tutorial sucks, don't blame the tutorial, there is such a thing as being stupid

I don't think your stupid though, I had the same problems with these tutorials, and really got quite pissed when I started. You just need to keep at it, try every possibility, and above all else being a lazy schmuck cannot help.
I'm so sorry for my bad English. When I wrote it I was starving and couldn't think straight.
Well, first of all I don't have dyslexic (I can tell beacuse my neighbour have it), and second of all the word I was trying to describe would be something like "my complaining text" which would be more acurate.

Now I see that I should have used a GUI Trigger, NOT a JASS Trigger and for that you have my thanks.
And now I have a new question: do I need to convert the trigger to Custom Text?

I hope you find this Quote's spelling better then my last one (really, really sorry for my awfull English)
And this tutorial doesn't suck (like I wrote) beacuse people obviously find it helpful so there must be something I'm missunderstanding.
Cheezeman is offline   Reply With Quote
Old 08-23-2008, 09:03 PM   #97 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Converting GUI to JASS comes later once one has learned all they need to know about functions {declarations, parameters, calling, returning}

When you reach this point...

GUI is actually a bad version of JASS (literally, the war3 processor converts GUI into a horribly odd-looking JASS script)

When you use the 'Convert to Custom Text' button, you get a glimpse of what it looks like

You'll notice something along these lines...

function <triggername>_Actions takes nothing returns nothing
    //Your actions
endfunction

function <triggername>_Conditions takes nothing returns boolean
    //Your conditions
endfunction

function InitTrig_<triggername> takes nothing returns nothing
    set gg_trg_<triggername> = CreateTrigger()
    call <Function name for your GUI event>(<parameters for the GUI event>)
    call TriggerAddAction(gg_trg_<triggername>, function <triggername>_Actions)
    call TriggerAddCondition(gg_trg_<triggername>, function <triggername>_Conditions)
endfunction

Now this probably looks extremely confusing, but I want you to focus on the 'CreateTrigger()' portion. This creates what JASSers call a 'handle'. A handle is basically a big piece of information that has special syntax and can do certain things. Here, our handle is a trigger, and what trigger handles do, is pretty much exactly what a normal GUI trigger can do. The important part right now, is registering events.

You can register an event to a trigger, and it will run like this...

When the specific event occurs...

if <TriggersAddedConditions> then
    <TriggersAddedActions
endif

An if-then similar to this will run and check to see whether or not the trigger will fire.

Your probably thinking to yourself, great, but how does the 'CreateTrigger()' function get called???

Well, the war3 processor has a 'main' function that runs all the various commands you told your WE to do in the different WE interfaces{such as creating units}. This 'main' function also calls each of your 'InitTrig_' functions

In order to have your function called in the 'main', you must fulfill 3 conditions.

1. You must create a regular GUI trigger and convert it to custom text, this doesn't sound like a big deal, but when you use the 'Custom Script' at the top of the trigger editor, you start to wish you didn't need to do this.

2.The next condition, is that the function must start with 'InitTrig_'

3.Lastly, after the 'InitTrig_' you must have the name of your trigger, this is because the war3 processor must need to know which functions are just functions and which one will be called in the main.
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 09-06-2008, 12:03 PM   #98 (permalink)
 
ShrEad-ER's Avatar

Solo Map Maker
 
Join Date: Aug 2008
Posts: 42

ShrEad-ER is an unknown quantity at this point (0)


ok... first of all... good tut!
the second... i think the tut was a little long and not descriping enough of the things that is possible... I THINK...
the third... i use to many of '...' dont you think? XD
__________________
A wise orc ones said - ''Stop poking me!''
A wise human ones said - ''Play Tristrain!''


Take the Magic: The Gathering 'What Color Are You?' Quiz.
[/center]
ShrEad-ER is offline   Reply With Quote
Old 10-01-2008, 07:25 PM   #99 (permalink)
 
TheBlooddancer's Avatar

Cute Kargo is Cute :3
 
Join Date: Jun 2008
Posts: 2,666

TheBlooddancer is just really nice (416)TheBlooddancer is just really nice (416)TheBlooddancer is just really nice (416)TheBlooddancer is just really nice (416)TheBlooddancer is just really nice (416)


Ehrm.. You guys lost me after "HelloWorld" :D

function UnitCreation takes nothing returns nothing
  local unit u = CreateUnit(XXX)
endfunction

What should be in the XXX? The Rawcode (h001)? Or the Name? (Ninja) or What?

And my W/E Keeps bugging with the GUI triggers also, after i made a mistake in JASS:
Please? Can anyone help?
__________________
Last edited by The Administration; Today at 15:08 PM.. Reason: Do not spam, flame, harass and discriminate other users in a such way.



TheBlooddancer is online now   Reply With Quote
Old 10-01-2008, 10:32 PM   #100 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Turn off or remove all of your JASS code until you find what is bugged and whats not.

The JASS Vault

Search around here for any questions you have about JASS functions, they will be in the common.j section

Quote:
function CreateUnit takes player id, integer unitid, real x, real y, real face returns unit
player id --> the variable type is 'player', and the name is 'id'

The name gives a hint to what the parameter is logically, here meaning the identity of the unit, or its owner

integer unitid --> An integer variable, the name is 'unitid', through experience I've learned this is the place for a units rawcode

real x --> simple enough, the exact x coordinate of where the unit will be placed

real y --> exact y coordinate

real face --> The degrees the unit will face, please note that this is in degrees, not radians

And that 'returns' bit means that you can set this function to a variable, as you have done already.

Your function could possibly look like this...

function UnitCreation takes nothing returns nothing
    local real x = GetRandomReal(0,10000)
    local real y = GetRandomReal(0,10000)
    local real face = GetRandomReal(0,360)
    local player owner = Player(GetRandomInt(0,10))
    local unit u = CreateUnit(owner, 'A001', x, y, face)
endfunction
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 10-02-2008, 01:12 PM   #101 (permalink)
 
vercas's Avatar

The almighty Lich...
 
Join Date: Dec 2007
Posts: 1,185

vercas has little to show at this moment (56)


I don't know too much JASS, but the real numbers mustn't have .00 or .[any number from 0 to 9][any number from 0 to 9]?

I think that you must add to the random real 0.00 and 10000.00 and 360.00
__________________
My dragons!

WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

(\__/)
(='.'=)
Spread the Emoticat!
WWWWWWWWWWWWWWWWWWWW
vercas is offline   Reply With Quote
Old 10-02-2008, 05:46 PM   #102 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


I'm not sure what you mean. As far as I know, your wrong, reals can be any real number, and the syntax for getting a random real in JASS is using that GetRandomReal function
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 10-02-2008, 05:49 PM   #103 (permalink)
 
vercas's Avatar

The almighty Lich...
 
Join Date: Dec 2007
Posts: 1,185

vercas has little to show at this moment (56)


Yes but 0 and 10000 are integers
0.00 and 10000.00 are reals
Shouldn't it be like this?
I just want to know
__________________
My dragons!

WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

(\__/)
(='.'=)
Spread the Emoticat!
WWWWWWWWWWWWWWWWWWWW
vercas is offline   Reply With Quote
Old 10-03-2008, 06:20 PM   #104 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Ohhhhhh, no it doesn't matter
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 10-04-2008, 08:58 AM   #105 (permalink)
 
vercas's Avatar

The almighty Lich...
 
Join Date: Dec 2007
Posts: 1,185

vercas has little to show at this moment (56)


Thank you for asking me
I just wanted to know :D
__________________
My dragons!

WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

(\__/)
(='.'=)
Spread the Emoticat!
WWWWWWWWWWWWWWWWWWWW
vercas is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump