• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Ask Questions When You're Uncertain

Status
Not open for further replies.
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ask questions : D

It seems like most people are failing this class right now, so ask questions when you're not sure about something ^)^.

Are you running the map after an assignment and not seeing anything? Ask what you did wrong =), everyone's totally willing to help.

Are you unsure about an instruction? The instructors totally have all of the answer keys, so they'll be able to explain what you need to do and what you should be getting.


Anyways, just mentioning this because the results over the past couple of weeks have been pretty bad and it's only going to get harder ;o. Let's be sure that we all know this stuff so that we can all succeed : D.

Also, if you need help on the projects (like possibly getting syntax errors, which I saw many ignored) or are completely lost, ask for help. I know I personally gave lots and lots of hints to the couple of people that asked for help on project #2, and they even succeeded in solving it =) (after a lot of effort and hard work).

I'll be the first to say that the projects are extremely challenging. They are puzzles and they require lots of problem solving and understanding of the material. However, if you are able to solve them, you'll only be that much better as a programmer.

Problem solving is everything in programming ^_^. It is one of the most important skills you can get. The projects are meant to develop your problem solving skills.


Anyways, hopefully we do better in the coming weeks. I'm sure that mag will also take 2nd attempts at the assignments and projects (you really should try to master this stuff before moving on ^.^). And once again, ask lots of questions. You don't necessarily have to submit the entire week in 1 pack, you can ask if you are doing some of the problems right or if you have the right idea on the project.


Anyways, good luck with the future weeks all : D.

Also, please don't be discouraged from the results of week 2.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
your question is little bit off topic dont you think? AFAIK, interfaces will not even be covered in the lessons but oh well
Interface is a pack of methods that can have default values for returning values and they declare methods in them.
When you declare interface with name, you can use that interface in functions and any struct that extends off of that interface can be passed in. Also if you have struct extending from interface you need to ensure the struct has all methods the interface declares, otherwise you will get some syntax errors.
Lets have a look:

JASS:
interface Hi
    method print takes nothing returns nothing
endinterface

struct AA extends Hi
    method print takes nothing returns nothing
        call BJDebugMsg("Hi from AA")
    endmethod
endstruct

struct AB extends Hi
    method print takes nothing returns nothing
        call BJDebugMsg("Hi from AB")
    endmethod
endstruct

function printtest takes Hi dummy returns nothing
    call dummy.print()
endfunction

function test takes nothing returns nothing
    local AA a = AA.create()
    local AB b = AB.create()

    call printtest(a)
    call printtest(b)
endfunction

This code will print Hi from AA and than Hi from AB.
You can also make some methods default returning value. Im not 100% sure how this works anymore since I only worked with this once and it was when I wrote tutorial for my friend(he didnt read it so far :( ) but I can try to explain what I know:
JASS:
interface Ho
    method bla takes nothing returns boolean defaults false
endinterface
the defaults keywords makes this bla method to be optional and structs extending this interface doesnt need to implement it, but if you call this method from struct that doesnt have it it will basically return false.

so now:

JASS:
struct A extends Ho
    method bla takes nothing returns boolean
        return true
    endmethod
endstruct

struct B extends Ho
endstruct

function testreturn takes Ho hh returns boolean
    return hh.bla()
endfunction

function test takes nothing returns nothing
    local A a = A.create()
    local B b = B.create()
    call BJDebugMsg(B2S(testreturn(a)))
    call BJDebugMsg(B2S(testreturn(b)))
endfunction
lets pretend we have function B2S defined that converts true boolean into string "true" and false boolean to string "false"

this will print:
true
false

So basically interface only clouds up some methods that structs extending them must(with keyword defaults are optional) implemented but every struct can have it implemented in its own way

you could have interface with method explode takes unit and have 2 different structs extending this inferface and while one will make the unit explode normally, the second one can make it explode with a Nuke Bomb Effect.

Disadvantage of interfaces is that it generates a lot of TriggerEvalutaions so its mostly not used at all


Hope this answers your question
 
Last edited:

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
If you guys would bother to put some info for each [course material] thread, like in week 1 so I can understand it and read it from this forum. That would be greatly appreciated.

Week 2 and Week 3 does only has map attached with very brief info to it and no informing jass inffo or hints in those threads.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
If you guys would bother to put some info for each [course material] thread, like in week 1 so I can understand it and read it from this forum. That would be greatly appreciated.

Week 2 and Week 3 does only has map attached with very brief info to it and no informing jass inffo or hints in those threads.

There is info for each week... it's all in the map, lol

Each map is loaded with 9-10 lessons, lots of practice, and a project
 
Level 3
Joined
Nov 30, 2012
Messages
30
My map sometimes goes strange problems.
Such as when using GroupEnumxxx,the group variable is null.
But I do CreateGroup and no DestroyGroup.
More terrible it occurs after 10 or 20 minutes game,and it works well at the begining.
I don't know if it because I create too many variables or no GroupClear after using it.

The second question is:
is library's initializer function work as called ExcuteFunc(functionNameString).
In my opinion ExcuteFunc has low effect but can protect the function from running too much code and break.
 
Status
Not open for further replies.
Top