ID:142879
 
Applicable Configuration:
BYOND Version: 412.977
Operating System: Windows XP Sp2
Web Browser: Internet Explorer 7
Game/Hub(s): Unknown/Not Applicable
Video Card (for graphics bugs): ATI Radeon 7000

Descriptive Problem Summary:When i use the below code, which ive used before i was thinking it should stop diagonal movement.

Numbered Steps to Reproduce Problem:use the code below to try and stop it

Code Snippet (if applicable) to Reproduce Problem:
mob
Move()
if(dir == SOUTHWEST)
return
if(dir == NORTHWEST)
return
if(dir == NORTHEAST)
return
if(dir == SOUTHEAST)
return
..()


Expected Results:it would stop diagonal movement, and instead of just putting return, ive tried putting return 0, and both of them error the same way.

Actual Results:I can move all four directions just fine, but once i try and go diagonal, i can move diagonal but only once.....but then after it moves diagonal that one time, all directions stop working, even the ones that were working at first.

Does the problem occur:
Every time? Or how often?Every Time
In other games?Unknown/Not Applicable
On other computers?Yes
In other user accounts?Yes

When does the problem NOT occur?Not Sure

Workarounds:Not sure...

It would all stop because after you moved diagonal once, that dir would stick. Then you would check to see if your dir is a diagonal direction, which it would be, and tell it to stop there. You'd be stuck until you changed your dir or edited your code because your dir would always be the same diagonal direction. It's your code, not a BYOND bug.
In response to Pyro_dragons
the reason for the bad code is because of the fact that i get a black screen if i put the proper code, so i tried this other way....

i need to know why this would be?
In response to Superbike32
What's the "proper code"? If it's giving you a black screen, it obviously isn't proper.

And to be honest, I've never tried to disable a diagonal direction before, so I can only diagnose the problem rather than offer a solution.

Perhaps if they try to move in a diagonal direction, just send them back to their previous location? I'm unsure.
In response to Superbike32
because as far as i know, this code right here is of course correct.

mob
Move()
if(SOUTHWEST)
return
if(NORTHWEST)
return
if(NORTHEAST)
return
if(SOUTHEAST)
return
..()


but i get a black screen every time that is anywhere in my code.
In response to Superbike32
Well, since Move() is a proc and nothing in front of any of those would default to src, and since src, being the mob, would never return a direction, that's why it won't work. Although why it would cause a black screen is beyond me. Someone else would have to explain that part.
if(SOUTHWEST)

is the same as
if(src.SOUTHWEST)

Move() is a proc, so src will default to the mob. The mob will never be a direction so...

Perhaps if they try to move in a diagonal direction, just send them back to their previous location, making it seem as if they never really moved? I'm unsure.
In response to Superbike32
that is the whole reason i posted under bug reports, cause ive tried using multiple ways that ive used in my other projects that still use these codes in these ways, and none of them seem to be working in my project.

i think its an error in the version i posted, as, if compiled with an older version, both of those codes seem to work fine, even the supposedly improper one.

whether it be an error in an old version or not, is not what concerns me, but of the fact even what shows in the dm guide isnt working is what does.
In response to Pyro_dragons
well, no matter what kind of obscure thing is going on here, it worked in previous versions, and would really like something that has been used in other games to work here.

ive even looked up movement library and other open source games, such as rise of heroes//etc... and all of them are not working right in this version, so therefor i propose this be moved back to bug reports...
Why not just overwrite Northwest(), Northeast(), Southwest(), and Southeast() to return 0?

Northwest()
return 0
This is happening because you are checking src's dir, rather than the actual direction of movement. The other thing you posted isn't working because you are checking a value which is always true.
In response to Superbike32
Superbike32 wrote:
well, no matter what kind of obscure thing is going on here, it worked in previous versions, and would really like something that has been used in other games to work here.

ive even looked up movement library and other open source games, such as rise of heroes//etc... and all of them are not working right in this version, so therefor i propose this be moved back to bug reports...

Format:
Move(NewLoc,Dir=0)

mob
Move(loc,ndir)
if(ndir == SOUTHWEST)
return
if(ndir == NORTHWEST)
return
if(ndir == NORTHEAST)
return
if(ndir == SOUTHEAST)
return
..()


You have to check the actual format of a proc, not just assume you can use the dir variable, considering the Move() action doesnt occur until ..() a mob that isnt already facing that direction will not have its movement stopped, conversely a mob that is currently facing that direction will be unable to move in any direction afterwards.

Read, the, references before filing a bug report.
In response to Masterdan
That's what I was thinking, but I wasn't completely sure if it would work and I don't have the files here to test it.
In response to Pyro_dragons
Pyro_dragons wrote:
That's what I was thinking, but I wasn't completely sure if it would work and I don't have the files here to test it.

I didnt test it either, but im sure itd work. Honestly though because Zeta and Nbotls dont use freaking parameters in the Move() proc ive noticed an entire generation of byond users dont have a freaking clue that Move does in fact have 2 very significant freaking parameters!
In response to Masterdan
i have posted this bug report since that obscure code i posted there had worked in previous versions of byond.

whether it was in the correct syntax doesnt matter to me AT ALL.

I was thinking that cause it worked in an older version, and was taken straight from my old game, that it would work.

the syntax dont really matter, and is some kind of bug if it worked before, and now it doesnt.

when i recompiled the game in the newer version of byond, it got the error the other guy complained of in some post somewhere.
In response to Masterdan
And you need to read the rest of the reference entry:

Returns:
1 on success; 0 on failure.

You need to return the value of ..() or you're going to start breaking things.
In response to Superbike32
No, what you posted would not have worked on any version of BYOND in existence.
In response to Masterdan
Masterdan wrote:
Pyro_dragons wrote:
That's what I was thinking, but I wasn't completely sure if it would work and I don't have the files here to test it.

I didnt test it either, but im sure itd work. Honestly though because Zeta and Nbotls dont use freaking parameters in the Move() proc ive noticed an entire generation of byond users dont have a freaking clue that Move does in fact have 2 very significant freaking parameters!

I knew about the parameters, and infact use them on multiple occasions. I was just not 100% sure on whether or not it would work because I couldn't check to be sure. I hate trying to give out code without testing it first if I'm unsure.
In response to Superbike32
> mob
> Move()
> if(SOUTHWEST)
> return
>


Remember, the directional defines are just going to be replaced with the corresponding number when you compile, so those conditions will always be true (if(1), if(8), etc.). If you happen to be using Move() to place characters on the map and Move() does nothing you'll still be off of the map (with a black screen).

If that worked in previous versions we've had quite an upgrade. ;)
In response to Masterdan
stop posting, i gave the correct solution without the move proc, and now i dont care anymore, and the old thing used to work in an older version of byond whether the syntax was ever correct or not must not have mattered much at that time in the older version.

if u look at the other post, using client instead of Move() i got it working 100%.

please pay attention, and dont post if ur not going to help, and stop posting just to criticize someone, it wastes space on the byond forums.

if u wanna help, post the solution, otherwise no reason to post, cause criticizing someone for getting it wrong is just mean, and u never posted a solution, so the person had never gotten helped from u criticizing me.
In response to Superbike32
Garthor has a hell of a alot more experience with the language than most people on this forum, including you and myself. While he is very blunt when it comes down to it, his code is some of the most efficient I've seen in a long time. Don't tell him to shut up, don't say he's not helping. It may sound very asshole-ish, but he is helping.
Page: 1 2