ID:1330395
 
(See the best response by Wissam.)
Code:
client/verb/chatroomwindow()
set hidden = 1
winshow(src, "main-window", "show=0")
winshow(src, "ooc-chatroom-screen", "show=1")
..()


Problem description: In an earlier project I used this same code in order to make windows from the interface appear and disappear. The window ID name is accurate, and the window "ooc-chatroom-screen" is invisible inside the interface. Neither the "main-window" or "ooc-chatroom-window" cooperate as they are set to do.

The command is set on a button in the "main-window" with the command in the bar, "chatroomwindow" as the command to be executed when the button is pressed, and it is not set to disabled.


http://www.byond.com/docs/ref/info.html#/proc/winshow

The last variable to be entered into winshow() should be a num, not a text string.

winshow([client or mob that presumably has a client], "[window].[control]", [num])


The num is either zero to hide the control/window, or ANY other number to show the control/window.
The DM reference was not helpful at all and that's what I based my line upon. Though I'm curious, what is the .[control] for? That's not outlined in the reference for winshow.

Also, I just redid the code in this format.

client/verb/chatroomwindow()
set hidden = 1
winshow(src, "main-window", 0)
winshow(src, "ooc-chatroom-screen", 1)
..()


I'm getting the same result as before and nothing is happening.
In response to Ryu-Kazuki
My bad, I was thinking of winset when I mentioned .[control]. Are your windows named properly in the interface file?
Yes, they're exactly as they're outlined inside each respective set of quotation marks.
In response to Ryu-Kazuki
Make sure the window isn't selected to be a pane.
In response to Ryu-Kazuki
Ryu-Kazuki wrote:
The DM reference was not helpful at all and that's what I based my line upon. Though I'm curious, what is the .[control] for? That's not outlined in the reference for winshow.

Also, I just redid the code in this format.

> client/verb/chatroomwindow()
> set hidden = 1
> winshow(src, "main-window", 0)
> winshow(src, "ooc-chatroom-screen", 1)
> ..()
>

I'm getting the same result as before and nothing is happening.

You're using hyphens instead of periods.

In response to Rushnut
Rushnut wrote:
Ryu-Kazuki wrote:
The DM reference was not helpful at all and that's what I based my line upon. Though I'm curious, what is the .[control] for? That's not outlined in the reference for winshow.

Also, I just redid the code in this format.

> > client/verb/chatroomwindow()
> > set hidden = 1
> > winshow(src, "main-window", 0)
> > winshow(src, "ooc-chatroom-screen", 1)
> > ..()
> >

I'm getting the same result as before and nothing is happening.

You're using hyphens instead of periods.

The hyphens are there because that's the name of the window. Even with them gone it doesn't change the effect.

And no, the windows aren't selected to be panes.

Might it have something to do with the command I have in the bar? It's got the same name as the verb to be executed when the button is pressed.
    winset(src, "main-window", "is-visible=false")
winset(src, "ooc-chatroom-screen", "is-visible=true")

Perhaps?
I'm not 100% sure but aren't skin elements tied to the mob not the client?

Try src.mob instead of src in your winshow()
Adding src.mob didn't change anything.

As for the winset, that's what I used back in my original format on my other project, which actually worked, but it's refusing to work here.
Just changed it to this, and no luck with it at all.

mob/verb/chatroomwindow()
set hidden = 1
winset(src, "main-window", "is-visible=false")
winset(src, "ooc-chatroom-screen", "is-visible=false")
..()
In response to Ryu-Kazuki
can we actually see the window name? Like a screenshot? Then again, I also think it's because of the hyphens...
Also I'm pretty sure you can't hide the default window under any circumstances.
In response to Rushnut
Rushnut wrote:
Also I'm pretty sure you can't hide the default window under any circumstances.

You can if you select the checkmark it has on the edit options of the interface. As far as otherwise I don't know. I'm gathering some screenshots for everything right now. I'll provide one with the command line as well.
In response to Rushnut
Maybe you can? With a work around? Say for example you would set the chat_room to default, and the main_window's default to null.. through
winset(src,"chat-window","is-default=true");
winset(src,"main-window","is-default=false");


That way you can always have a default window. Just because it's the main window. Doesn't mean it has to be default.
http://i40.tinypic.com/2ut1b49.png

That's the shot of inside my interface with the list of windows.

http://i39.tinypic.com/2v2utzt.png

And that's the one with the command in the line for the button edit.
Best response
Your button's command says...
"openchatroomwindow"
While the code you provided us with is just
"chatroomwindow"...?
when it's supposed to be
mob/verb/openchatroomwindow()

instead of..
mob/verb/chatroomwindow()
Wow, I didn't notice that.. Thanks for catching that. I feel dumb now.

Either way, I appreciate all the help, guys.
In response to Rushnut
They work for both :)

Format:
winshow(player, window, show=1)
Args:
player: A mob or client.
window: The name of a window in the player's skin.
show: Use a nonzero value to show the window, zero to hide it.


Ryu, what exactly is happening? Is the chatroom window showing up? Is the main window hiding? Or are neither working.

I prefer winset() regardless. Also, to save on parameters (and effectively create my own winshow, but without the need for the 3rd parameter), I created my own proc for this.

proc
toggle_win(mob/m, t, Shows)
if(Shows==1) { winset(m, t, "is-visible=true;"); return }
if(Shows==0) { winset(m, t, "is-visible=false;"); return }
var/tog = winget(m, t, "is-visible")
if(tog == "true") tog="false"
else if(tog == "false") tog="true"
winset(m, t, "is-visible=[tog];")

m is the target, t is the control, and Shows is the toggle
If a parameter is supplied (1 or 0) one of the first two conditional statements are run. If not, it toggles it for you.
Page: 1 2