A plead for sanity...

Status
Not open for further replies.

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165
Lately I've seen scripts that is not only confusing, but also impossible to understand. Please, whenever you are asking for help, or helping others in GUI script or JASS...

>>> Use comments <<<

No, I am not asking you to explain to me what each line means, you just need to explain what each segment of code do. Even a general idea of the function is a good start. The helper or the person asking should not be guessing what your code is trying to do.

Example of good comments:
JASS:
local integer x = 0 // for loop integer counter
loop   // this loop creates 5 units, move them to a random location in LOCATION, and give them ability XYZ.
    exitwhen x &gt; 5
    call CreateUnitAtLoc (...)
    call MoveUnit (...)
    call AddAbility (...)
    set x = x + 1
endloop // x = 6 here


Example of bad comments:
JASS:
local integer x = 0 // for loop integer counter
loop
    exitwhen x &gt; 5  // exit the loop when x &gt; 5
    call CreateUnitAtLoc (...) // create a unit at location
    call MoveUnit (...) // move the unit to random point in LOCATION
    call AddAbility (...) // add ability XYZ to unit
    set x = x + 1 // increment x
endloop


This case, the first example is much easier to understand than the second one, which is basically repeating what the code "said".

Also, I've seen increasing use of variable names like "u" and "s". These variables are totally meaningless, and also makes the code very hard to understand (The exact reason I am so against the use of GetTriggerUnit() without accompanying comment.) Please, try to use variable names that is relevant to the thing it is trying to do, like "caster" for the caster, "victim" or "target" for the target unit. Remember, you are here to help, or to be helped.

Thanks.
 

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165
The problem is people are posting codes without comments and using ugly variables. They tend to make code deceiphering very difficult.
 

waaaks!

Zinctified
Reaction score
256
yeah some people...but others do JESP, to make people understand on what they made
 

Pineapple

Just Smile.
Reaction score
576
>> Lets make Duwenbasden charity fund to help him out.

Please give generously, for every $1 we can get one more noob off the course of bad variables and comments.:D
 

waaaks!

Zinctified
Reaction score
256
>> Lets make Duwenbasden charity fund to help him out.

Please give generously, for every $1 we can get one more noob off the course of bad variables and comments.:D

lol...we are about a thousand or more, meaning $1 each = $rich$ :D
just kiddin
 

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165
>> Lets make Duwenbasden charity fund to help him out.

Please give generously, for every $1 we can get one more noob off the course of bad variables and comments.:D

not only noobs, even some mods are also in the habit.
 

elmstfreddie

The Finglonger
Reaction score
203
You delete my reply or something?

But I'm purely serious, once you know the intention of the trigger you should be able to know what does what, unless it's poorly scripted or something, but it should still be readable by you...

Either that or I'm some kinda genius :rolleyes:

Besides, shouldn't this be in the JASS zone, since GUIers shouldn't use comments?

(PS the only time I use comments is to remind my self to put a line of script where the comment is)
 

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165
It is a difference between 5 seconds to read the general idea and understand immediately and 45 seconds to try to understand the code line by line and guess the intention. Sure I can do it, but even 1 line of description makes a lot of difference.

No I didn't delete your reply.

once you know the intention of the trigger

That's the point, post the intentions and comment on some weird/complex parts. I've seen some questions started without anything aside from 10-20 lines of code and then "why doesn't it work??!?!?!"
 

elmstfreddie

The Finglonger
Reaction score
203
No I didn't delete your reply.
Okay, weird, 3 times now something didn't post :confused:
Anyways, sorry if I sounded angry.
I seriously don't think comments are necessary >_<
It's about as anal as "planning your map on paper"

Right, 40 seconds, vital.
Don't say well the amount of script you read * 40 really adds up...
Because we are all wasting all that time on this website :p
 

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165

elmstfreddie

The Finglonger
Reaction score
203
Seems completely useless, you never set l you just take it then return it... Then you remove locations that were never set?
Then you create a peasant???

As I said though, it's required you know what it's supposed to do in the first place :p
 

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165
That's the point I've been trying to put across. Some people post codes and nothing else and expect us to help them. The confusing variables only adds to the fire.

thing creates peasants in compass directions (NESW), if the integer i is not 0, create 4 more peasant in compass directions WITH that new location with half the distance of the original compass.

So:
Code:
			1

		1	2	1
	
	7		1		3
	
7	8	7	H	3	4	3

	7		5		3

		5	6	5

			5

H = Host's, caster's, spawner's location
Peasant in "1" is created first, then 2, and so on.

P.S.: Assuming the location is passed to thing, and r (radius) and i (iteration) is given by user.
 

elmstfreddie

The Finglonger
Reaction score
203
Wait you changed it then when I last looked at it... Lemme read it again -.-

Okay, pretty much the same gayness.
What is thing btw >_>
Some function that that "annoying person" did not post?

I took this as a complaint about comments, not lack of data ;)
 

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165
lack of data is pretty much the same as the lack of comments. The only thing comments do is clarify things and help people understand. The descriptions I gave you are comments. Without comments, most people will have no idea what the function does.
 

elmstfreddie

The Finglonger
Reaction score
203
All you needed to do was post thing and I coulda understood ;)

STOP EDITING YOUR POSTS AFTER I REPLY! LOL!

Anyways, you just contradicted yourself... You said comments are a lack of data, then you said they only clarify things???

ANYWAYS WHO GIVES A CRAP >_<
Rants are for hormonal people :cool:
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top