ID:2084189
 
(See the best response by Nadrew.)
Code:
var/image = winget(src, "button1", "image")


Problem description: I use the above line of code to get the image of a button. All the images for buttons are stored in folder Images\Buttons\
As I use the above for different buttons, it sometimes gives ie "Images\Buttons\redbutton.png" and either it gives "bluebutton.png", that it, it sometimes gives the full path and sometimes it doesn't. But... why? As I said, bluebutton.png and ALL button images are in the above same folder...

Thanks

It depends on how the file was referred to when it was compiled.
Out of curiosity, why would you need to ask the button what state it was in on the client?

The reason I ask is because there are some things that you shouldn't need to parse:

Like the view size, or screen locs of objects, or the icon state of something.

This is where backed data can come in handy. BYOND is a server-directed language, so often if you are asking the client about information that they don't have the power to change, that indicates that the data isn't being hung on to properly.

Back the data on the server when you set it. Since the button's image can't be changed by the player, the server has no reason to not know what's there.
Thanks for the answers! Didn't understand much from the last one Ter tho cuz I am new to byond :<

I am making an intentory/menu that the client enters/exits by clicking a button, so that button's image must change like "enter menu" image then once clicked "back to game" image shows so that the player can go back to game. I have to use the above code this way so, if button is clicked, retrieve image. If 1st image is used, display second else, opposite.
Best response
You'd save a bit of overhead (winget() is kind of clunky) by simply having a variable like 'in_menu' that gets set as the bottom gets clicked and then set the details of the button accordingly, that way you only have a winset() and not a winget() and a winset() every time.

That's what Ter was talking about, keeping the server aware of the state of the button without having to query the client about it every time.
Ok, got your point. What's wrong with winget though and I should avoid it? Despite the full-or-not-path thing that I am addressing, it works just fine for me...
Basically, winget() is slow. The server has to ask the client to give it an update on where things stand, the client responds, and the response is handled like a sleeping proc--on the same tick if it had other work to do and gets to it fast enough, but otherwise on the next tick.