Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: BYOND Coding Help  (Read 4890 times)

quinnr

  • Bay Watcher
    • View Profile
BYOND Coding Help
« on: May 24, 2010, 10:09:30 pm »

Thought this would be nice to have, with all the BYOND games becoming more popular. You can use this thread to ask or give help relating to the BYOND (byond.com) game engine coding.

I already have a question:
How do I use an icon in a different folder as my icon?
icon = '/icons/player.dmi'

?

I've got the basics down though...mostly. These tutorials are a godsend:
http://www.byond.com/members/DreamMakers?command=view_post&post=40355
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: BYOND Coding Help
« Reply #1 on: May 25, 2010, 06:52:35 am »

In general, you can usually omit the path, so 'player.dmi' would work, as long as there is exactly one player.dmi in the environment. If there are more, you might need to include the full path.
Logged
Eh?
Eh!

quinnr

  • Bay Watcher
    • View Profile
Re: BYOND Coding Help
« Reply #2 on: May 25, 2010, 11:16:37 am »

That worked, thanks.

Now I just need to know if it's possible to dynamically rotate a player, for example: To turn in the direction they are moving.
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

Duelmaster409

  • Bay Watcher
  • [DOES_NOT_FIGHT]
    • View Profile
Re: BYOND Coding Help
« Reply #3 on: May 25, 2010, 11:43:14 am »

You could always just turn() the dir of the mob by negative or positive val
Code: [Select]
client
    West()
        mob.dir=turn(mob.dir,45) // If you don't want to include diagnols, change this value to 90
    East()
        mob.dir=turn(mob.dir,-45) // Negative here to turn in the opposite direction
Logged
Dwarf fortress: Teaching uni level geology to sadistic elf killers for years.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: BYOND Coding Help
« Reply #4 on: May 25, 2010, 05:28:23 pm »

That looks like making "left" and "right" make the player turn left or right(Edit: clarification: left or right relative to the direction they are facing, not the client's view), I interpret the original question of making the player's icon face in the direction they are moving.

In that case, ensure that their icon is a movie with every desired direction having an image(a movie can be one frame long, and is the only way to support directions in an icon file)

After that, the player's dir var will set what icon direction is shown. Also, the default function of /atom/moveable(/mob)/proc/Move() sets dir automatically.

So, simply give them a movie for an icon, if you don't want them animated use 1 frame, and then set the directions you want and create images/animations for them.
Logged
Eh?
Eh!

eerr

  • Bay Watcher
    • View Profile
Re: BYOND Coding Help
« Reply #5 on: May 27, 2010, 01:45:49 am »

That worked, thanks.

Now I just need to know if it's possible to dynamically rotate a player, for example: To turn in the direction they are moving.
To rotate the direction the player is trying to move?
Logged

quinnr

  • Bay Watcher
    • View Profile
Re: BYOND Coding Help
« Reply #6 on: May 27, 2010, 02:13:28 am »

Yeah.
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

eerr

  • Bay Watcher
    • View Profile
Re: BYOND Coding Help
« Reply #7 on: May 28, 2010, 04:23:13 pm »

I would guess the code receives keypresses somewhere, maybe if you find that...
Logged

UzuStark98

  • Escaped Lunatic
    • View Profile
Re: BYOND Coding Help
« Reply #8 on: September 30, 2011, 07:46:01 am »

Hey guys, i need help...

I made a menu (example: File,Options and messages and stuff that is up on the left) and made it function but the prob is i need it to be undisabled when a button is pressed, How do i do that like whats the var that i use?
Logged

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: BYOND Coding Help
« Reply #9 on: September 30, 2011, 12:24:10 pm »

Hmm, this reminds me of Game Maker.
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: BYOND Coding Help
« Reply #10 on: September 30, 2011, 09:10:08 pm »

Interacting with a player's windows/menus/other bits of UI generally requires using winset(). Probably something like winset(player, "some-menu", "is-disabled=false")
Logged
Eh?
Eh!