ID:156709
 
1) Okay, i would like to know the command to toggle a window, i tried 'toggle_windowname' where 'windowname' is the name of the window. and also tried it with the underscore, because those seem like likely commands, but neither worked.

2) how would i be able to make a pane, that displays a ragdoll-type thing, where it shows the equipment slots, and the icon of what is equipped in that slot, if anything? i have no idea how to even start that, or where to look, since the byond guide doesn't deal with interfaces...

If you have a tutorial, guide or anything of that nature i can check out please let me know, i suck at interfaces and really want to learn how to code, and use them, and help is greatly appreciated.
1) Try winshow.

2) You could place grid controls in the pane and then output the equipment to them. Alternatively, you could place labels and then use winset to set their images.

More info can be found inside the Reference section found under the Developers menu at the top of the site. However, there is also a skin reference under the Help menu in Dream Maker. The latter probably lays it out easier as it's dedicated to the subject.
In response to ACWraith
The skin reference is only a table chart, i need examples ( I do not copy code like some people, i use examples to leanr, as it is the way i learn best, by seeing it ,and breaking it down and figuring out what each segment does...)

Do you know the command to toggle a window/pane? (I am asking before i checked the links you gave, so they may be in the links ,it is just my laptop is low on battery, so i would rather ask now, to save time in the future, lol.
In response to Wolfnova
Ah, winshow is the command, thank you very much.
In response to Wolfnova
Yeah, winshow will work for the windows you originally asked for.

I'm not sure if it's always necessary, but I use winset to display/hide panes. The parameters depend on the control that contains them. For tab controls, I set the "tabs" parameter to the comma-separated list of pane IDs I want displayed. For child controls, I set the "left" or the "right" parameter to the pane ID I want displayed. When I don't want anything displayed, I use a blank ID.

(I tend to swap panes a lot to hide unnecessary portions of my interface.)
In response to ACWraith
ACWraith wrote:
Yeah, winshow will work for the windows you originally asked for.

Alright, i did what the reference said, and here is my code... yet it is not working (i just named the window 'temp' as a test... i also, put a macro, in the interface, to call the verb for toggling the window when you press 'p')

verb
togglewindow()
winshow(usr,temp)


I cut out most of my other code, as it is irrevlant, so that is why it is so small, lol, i made a main window, the 'temp' window, set visiblilty, to 0 on the temp window, because i do not want it to show when you first enter the game, i also tried it with visibility set to 1, it showed, but the command still does not work. (visibility, or at least the visibility i am talking about is the one on the window options, called 'Visable')
In response to Wolfnova
Your other code might not be irrelevant since that shouldn't compile as it is. Did you forget to put quotes around "temp" in your post or create a var named temp and remove the code where you assigned it a value?

The second argument of winshow() should be the window ID in quotes. (Alternatively, it can be a var set to that value, but I'm assuming you know that much.) For example, a window called myWindow would require winshow(usr,"myWindow"). The ID might be case-sensitive so be sure to use the same capitals and lowercase letters.

I created a skin with an extra window called window1, unchecked the visibility, used the following code and created a macro that called it when I pressed the P key. I ran it, pressed the P key and window1 popped up.
client
verb
showwindow()
winshow(usr,"window1")



(Also, you'd want to adjust the third argument of winshow to toggle the visibility back and forth. Right now, your verb is set to display the window and not hide it.)
In response to ACWraith
ACWraith wrote:
Your other code might not be irrelevant since that shouldn't compile as it is. Did you forget to put quotes around "temp" in your post or create a var named temp and remove the code where you assigned it a value?

The second argument of winshow() should be the window ID in quotes. (Alternatively, it can be a var set to that value, but I'm assuming you know that much.) For example, a window called myWindow would require winshow(usr,"myWindow"). The ID might be case-sensitive so be sure to use the same capitals and lowercase letters.

I created a skin with an extra window called window1, unchecked the visibility, used the following code and created a macro that called it when I pressed the P key. I ran it, pressed the P key and window1 popped up.
client
> verb
> showwindow()
> winshow(usr,"window1")

(Also, you'd want to adjust the third argument of winshow to toggle the visibility back and forth. Right now, your verb is set to display the window and not hide it.)

Sometimes i miss the most obvious solutions, i forgot the quotes around ID name, also, couldn't, instead of just opening, inside the verb, set up an If() statement, so if it is open, close it, or if it is closed, open it? and set that verb to 'P' marco, Eh, i will play around with it.... ( now watch as a result of me playign around... going to get about 10-15 errors XDD
In response to ACWraith
ACWraith wrote:
Your other code might not be irrelevant since that shouldn't compile as it is. Did you forget to put quotes around "temp" in your post or create a var named temp and remove the code where you assigned it a value?

The second argument of winshow() should be the window ID in quotes. (Alternatively, it can be a var set to that value, but I'm assuming you know that much.) For example, a window called myWindow would require winshow(usr,"myWindow"). The ID might be case-sensitive so be sure to use the same capitals and lowercase letters.

I created a skin with an extra window called window1, unchecked the visibility, used the following code and created a macro that called it when I pressed the P key. I ran it, pressed the P key and window1 popped up.
client
> verb
> showwindow()
> winshow(usr,"window1")

(Also, you'd want to adjust the third argument of winshow to toggle the visibility back and forth. Right now, your verb is set to display the window and not hide it.)


Okay here is my code...

mob/char
icon = 'human.dmi'
verb
togglewindow()
winget(usr,"Temp","show")
if(1)showwindow()
else closewindow()
showwindow()
winshow(usr,"Temp",1)
closewindow()
winshow(usr,"Temp",0)


It will open but not close, i tried instead of just '1' or '0' i put 'show=1' and 'show=0' but i got this error 'error: winshow: expected 2 to 3 arguments (found 1)' it said if it is zero, it will close the window, so i am just not getting it i guess :/
In response to Wolfnova
There's a few things going on here.
  • There is no "show" parameter for skin controls. The "is-visible" parameter provides an alternative.
  • Non-zero numbers evaluate to true. Your attempt should have checked the text returned by winget() rather than the constant number 1. Your togglewindow() verb was set to always call your showwindow() verb.
  • Windows each have their own macros. While the Temp window is in focus, the P key probably isn't bound to a macro... I suppose I should have caught that one before, but I tend to focus on a single window with multiple panes in my own work. Sorry.


Providing you set your Temp window's macro, you could do the following and get rid of the two extra verbs.
togglewindow()
winshow(usr,"Temp", (winget(usr,"Temp","is-visible") != "true") )


However, the winget() proc requires more data to be sent across the network. You might want to lose the togglewindow() verb instead. You could call showwindow() with the main window's macro and closewindow() with the Temp window's macro. Granted, that would mean the Temp window would only be closed if it was in focus, but that could be common if players are using the keyboard instead clicking windows with the mouse.
In response to ACWraith
ACWraith wrote:
There's a few things going on here.
  • There is no "show" parameter for skin controls. The "is-visible" parameter provides an alternative.
  • Non-zero numbers evaluate to true. Your attempt should have checked the text returned by winget() rather than the constant number 1. Your togglewindow() verb was set to always call your showwindow() verb.
  • Windows each have their own macros. While the Temp window is in focus, the P key probably isn't bound to a macro... I suppose I should have caught that one before, but I tend to focus on a single window with multiple panes in my own work. Sorry.

Providing you set your Temp window's macro, you could do the following and get rid of the two extra verbs.
togglewindow()
> winshow(usr,"Temp", (winget(usr,"Temp","is-visible") != "true") )

However, the winget() proc requires more data to be sent across the network. You might want to lose the togglewindow() verb instead. You could call showwindow() with the main window's macro and closewindow() with the Temp window's macro. Granted, that would mean the Temp window would only be closed if it was in focus, but that could be common if players are using the keyboard instead clicking windows with the mouse.


What i am planning to do, is make the macro to oopen it, in the main window, and make a button, executing the command to close it, in the temp window. Also you do not need to say sorry about anything, lol, your trying to help, you notice your the only responder to my posts? your the only one that tried to elp, and for that i am thankful, and i have been trying to get the interface stuff to work...
In response to ACWraith
ACWraith wrote:
However, the winget() proc requires more data to be sent across the network. You might want to lose the togglewindow() verb instead. You could call showwindow() with the main window's macro and closewindow() with the Temp window's macro. Granted, that would mean the Temp window would only be closed if it was in focus, but that could be common if players are using the keyboard instead clicking windows with the mouse.

What i did, is just called togglewindow() for the close button, and as a macro, with makes sense, as it is a window, focus may switch bake to the main window, and if they want to close it, they can just use the macro, instead of having to go to the button on the other window.
In response to Wolfnova
Wolfnova wrote:
called togglewindow() for the close button

Could you elaborate what you're trying to achieve?
I'm not sure that I really understood, but if you're working with a button in the interface, you don't need winget at all.

"Conditonals are also supported, but only for the .winset command used in DS or in skins. The winset() proc in DM does not technically support them. The format is like so:

condition?choice1:choice2"
In response to Schnitzelnagler
I find that sometimes it helps to use "src" instead of "usr" when using winset() commands. Here is a simple example for toggling windows using a key press.

/*
NOTES:

There is an interface file, and included are the following:
* A macro with one item:
SPACE = Toggle-Window

* Windows:
default (the default window)
main (the window to be popped-up, not default)

It helps that both wnidows in the interface have their macro ID's set to
the same macro so that you can use Toggle-Window no matter which window has
focus.

*/



mob
verb
Toggle_Window()

// check to see if the window is currently opened
// returns "true" if it's up
// returns "false" if it is not opened.

var/V = winget(src,"main","is-visible")

// if the window "main" is closed,
// opene it, but give the window "default" the user's focus
// (Focus is like an involuntary mouse-click to the "default" window)

if (V == "false")
winshow(src,"main",1)
winset(src,"default","focus=true")

// if the window is already open, close it. Focus will automatically
// return to the window "default."

else if (V == "true")
winshow(src,"main",0)
In response to Makeii
First of all, please try to respond to the right person. This will not only trigger an automatic notification, but allows for easy reading of threads.

As for using src instead of usr, you seem to think these are mystic variables that one should try to find the right incarnation of a magic chant. There is no magic involved in programming, so a simple 'try this magic formula' advice is kind of bad.
In response to Schnitzelnagler
Schnitzelnagler wrote:
Wolfnova wrote:
called togglewindow() for the close button

Could you elaborate what you're trying to achieve?
I'm not sure that I really understood, but if you're working with a button in the interface, you don't need winget at all.

"Conditonals are also supported, but only for the .winset command used in DS or in skins. The winset() proc in DM does not technically support them. The format is like so:

condition?choice1:choice2"

I am not using winset -.-
In response to Makeii
Makeii wrote:
I find that sometimes it helps to use "src" instead of "usr" when using winset() commands. Here is a simple example for toggling windows using a key press.

> 
>
> /*
> NOTES:
>
> There is an interface file, and included are the following:
> * A macro with one item:
> SPACE = Toggle-Window
>
> * Windows:
> default (the default window)
> main (the window to be popped-up, not default)
>
> It helps that both wnidows in the interface have their macro ID's set to
> the same macro so that you can use Toggle-Window no matter which window has
> focus.
>
> */

>
>
> mob
> verb
> Toggle_Window()
>
> // check to see if the window is currently opened
> // returns "true" if it's up
> // returns "false" if it is not opened.
>
> var/V = winget(src,"main","is-visible")
>
> // if the window "main" is closed,
> // opene it, but give the window "default" the user's focus
> // (Focus is like an involuntary mouse-click to the "default" window)
>
> if (V == "false")
> winshow(src,"main",1)
> winset(src,"default","focus=true")
>
> // if the window is already open, close it. Focus will automatically
> // return to the window "default."
>
> else if (V == "true")
> winshow(src,"main",0)
>
>


Wow all these posts AFTER i got it solved -.-
In response to Schnitzelnagler
Schnitzelnagler wrote:
First of all, please try to respond to the right person. This will not only trigger an automatic notification, but allows for easy reading of threads.

As for using src instead of usr, you seem to think these are mystic variables that one should try to find the right incarnation of a magic chant. There is no magic involved in programming, so a simple 'try this magic formula' advice is kind of bad.

I do not use src instead of usr, i never asked that either, as far as i remember, are you sure you are responding to correct thread? because your last post is totally irrelevant.
In response to Wolfnova
Schnitzelnagler's last post was replying to Makeii.

His post about using winset inside of buttons is also correct. If your verb isn't doing anything else, calling winset inside the skin is a good idea because nothing needs to be transmitted over the network. It can all be done more quickly on the client's end.

Try placing something like the following in the command field of your macro or button:
.winset "Temp.is-visible=true ? Temp.is-visible=false : Temp.is-visible=true"

Note that the period in the front is important.
In response to Schnitzelnagler
I know what 'usr' and 'src' do. I just like using 'src' because most of the skin-related commands are usually contained in the client's mob.

EDIT: That is, most of the skin-related verbs I MAKE are in the client's current mob.