Semi-broken 'if' script

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Semi-broken 'if' script

Post by Blue Shadow »

GooberMan wrote:He tried your method and didn't get the correct result. This indicated a lack of understanding.
Again, understanding how that line of code works has no impact whatsoever on the end-result. The reason the script didn't work as expected, was because we all assumed the OP was using ACS_Execute. But, no, he wasn't. Not until later we found out he was using UsePuzzleItem. And that, apparently, changes everything.

What I don't get is why your code fix will work in that particular case, and mine won't? Give me a valid reason - I don't know, maybe I'm missing something here.
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: Semi-broken 'if' script

Post by GooberMan »

Yes, you are missing something here - he obviously pasted your line of code in wrong.

Thus, having a complete and correct script for context/reference with an explanation is better for instructional/educational purposes and is in no way a slight against ditching the > 0 check.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Semi-broken 'if' script

Post by Blue Shadow »

I told him to change the if statement part, not replace the whole script with my line, because that's where the problem lies - he's obviously aware of that (again, this was based on the assumption that he was using ACS_Execute at the time).

Oh, and you didn't answer my question above? (when answering, just pretend that the script is complete, and it's not just a one line of code). Here's the question, again:
I wrote:What I don't get is why your code fix will work in that particular case, and mine won't?
Yeah, they're the same, technically. Why will yours work, and mine won't? Explain it to me - I don't mind learning what I did wrong with the script.
Spoiler:
User avatar
Enjay
 
 
Posts: 27203
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Semi-broken 'if' script

Post by Enjay »

I'll risk stepping in here. :P

I don't think that Gooberman is saying that you code doesn't work. It does and should have - Doom'd Marine must have made a mistake using it.

I think what Gooberman is saying is that what you posted is a shorter-hand way of writing things and as such, it perhaps isn't quite as clear to a scripting newbie what it is doing.

Gooberman's code explicitly states that it is checking to see if the value is greater than 0 and does so in a form that can pretty much be translated into English. "If checkinventory skulls is greater than zero, do stuff." Your version, to the uninitiated, feels like something is missing if you try and say it in English. "If checkinventory skulls, do stuff." It feels like the "how many skulls are we looking for" bit isn't there. The suggestion, I think, is that once a person knows Gooberman's version, they can then be told "there's a shorter way of doing this BTW" but Gooberman's assertion seems to be that it's better to know and understand the longer version before learning the shortcuts.

Yes? No? Maybe?
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: Semi-broken 'if' script

Post by GooberMan »

Exactly right.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Semi-broken 'if' script

Post by Blue Shadow »

Enjay wrote:I don't think that Gooberman is saying that you code doesn't work. It does and should have - Doom'd Marine must have made a mistake using it.
Then why does he "turn left and right" instead of just simply saying it, and refer to his code as "the correct code"? - He's disregarding my approach, like it's a complete failure.
I think what Gooberman is saying is that what you posted is a shorter-hand way of writing things and as such, it perhaps isn't quite as clear to a scripting newbie what it is doing.
All the OP needed to do was remove the "<1" part from his original script, and it should've worked. That's the difference if you look at it. And as I previously said, I'll explain it to Doom'd Marine if he's interested in knowing. I'm not gonna assume he's as experienced as I am or more. I never do assume that when helping/explaining things to someone, unless I fully know they are. I'll explain it as best as I can to make him understand it.

Don't get me wrong. I fully understand why Gooberman used that approach, but I didn't like/appreciate him "putting me on the side" like that. It's like "hey, move aside, dummy! This is how the script should look like".
User avatar
Enjay
 
 
Posts: 27203
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Semi-broken 'if' script

Post by Enjay »

Well, I can't be held responsible for another person's turn of phrase or how that phrase is interpreted by others. ;)

Text-only is a medium where it is very easy to give an unintended intonation or to take a particular intonation from something we read that wasn't even considered by the person making the statement. I don't know if that's the case here or not but, either way, I think it's time for me to butt out again. :)
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: Semi-broken 'if' script

Post by GooberMan »

Nah, the diplomacy is appreciated.
Blue Shadow wrote:All the OP needed to do was remove the "<1" part from his original script, and it should've worked. That's the difference if you look at it.
And yet, I'm not interested in fixing everyone's problems. What I'm interested in is increasing everyone's collective skillset. Hence why my first post in this thread was explaining how an if statement should be used. And yes, making the judgement call that he was struggling to understand an if statement is based on a decade of professional experience, both in reading other people's code and teaching other people to code. You might hesitate to assume a skill level, but I can see one from reading code.

I'm sorry that you misread my intentions, and I did acknowledge that you were correct throughout the thread.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Semi-broken 'if' script

Post by Blue Shadow »

GooberMan wrote:And yet, I'm not interested in fixing everyone's problems. What I'm interested in is increasing everyone's collective skillset.
I'm not an instructor, and we're not in school. If someone posts something for help, I'll help them the way I choose to help them with; I might fix/create a code, try to explain something, or refer them to other sources like other topics or the ZDoom Wiki. That's what I've always done in the two years I've been here, and it seems to work well. I'm perfectly fine if someone sheds some more light or give alternate or better solutions to a problem than I did, heck, it enriches my knowledge as well, but I didn't appreciate what you did there, honestly,
I'm sorry that you misread my intentions
Then you better choose your words more carefully, next time. Think about what you'd just typed before you hit the "submit" button. We're not your buddies or work colleagues who are used to you.
I did acknowledge that you were correct throughout the thread.
I tried, but couldn't see it. And I did even ask, but couldn't get a clear, straight answer. It's like you didn't want to acknowledge it.


Look, all I'm asking is not to be disrespected (yes, believe it or not, that's what I felt). True, I'm not awesome by any means, and have nothing to be liked for - I'm just some random guy, but that doesn't mean I should be disrespected.

Am I asking much, here?
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: Semi-broken 'if' script

Post by GooberMan »

Blue Shadow wrote:Then you better choose your words more carefully, next time. Think about what you'd just typed before you hit the "submit" button.?
You know what? I've approached this thread with respectful replies, and yet you've indicated you have a stone to grind by bringing up the Sgt Mark thread.

Learn to read and PM me if you have a problem. Stop polluting this thread.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Semi-broken 'if' script

Post by Blue Shadow »

GooberMan wrote:I've approached this thread with respectful replies, and yet you've indicated you have a stone to grind by bringing up the Sgt Mark thread.
No, no, no... don't act like you're the victim, here. I didn't like your attitude then (and I don't like it now), but I held myself from saying anything, as I don't usually like drama and arguments, especially, if I'm not the one concerned in said drama and arguments. When you eluded that I was trying to be clever here (which I wasn't), then I immediately thought of what you did there, and couldn't help myself this time, because to me, it looked like you were the one who was trying to be clever.
Learn to read and PM me if you have a problem. Stop polluting this thread.
No, I'm done, sir. Because it's clearly you have an attitude problem, and a massive ego that is preventing you from admitting that you did someone wrong, thus there is no point of dragging this any further.
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: Semi-broken 'if' script

Post by GooberMan »

You can't call someone a smart ass and act like you're blameless. It doesn't work like that. Your attack was unwarranted, an overreaction, and dragged up something (in your own admission) that you didn't like. And let's face it - this thread would not have degenerated in the fashion it did if I didn't commit the cardinal sin of criticising Sgt Mark within the last week. You had your chance to be respectful, yet you posted inflammatory remarks. If you wanted me to care if you were offended by anything I posted, it was before that point. You well blew it.

And the best part? Despite you thinking that I should think about what I post before I post? I thought about including your line of code in to my post before I wrote it. And I came to the conclusion that it would not help the guy learn. As I pointed out in proceeding posts, while I was aware that your line was also a correct way of doing it, it wouldn't help a newbie that was struggling to understand an if statement, would it?

There is something we agree on though - there really is no point of dragging this out further.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Semi-broken 'if' script

Post by Gez »

It was time somebody stepped in and stopped the slapfight. So here is the real reason why this script didn't work. I'm the expert here. :ugeek:
Doom'd Marine wrote:
Spoiler:
The mistake is in the last line: it should be "almost as if something is meant to be placed inside of it". ACS is just being touchy about proper spelling. :P
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Semi-broken 'if' script

Post by randi »

Thank you, Gez. You are a great and irreplaceable asset, and your prowess is truly appreciated. :)
Locked

Return to “Editing (Archive)”