SphereCommunity
dialog pages - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: dialog pages (/Thread-dialog-pages)



dialog pages - richm - 08-11-2014 02:35 AM

Hello

Can someone explain the correct way to call different pages in dialogs? Ive never used them before Confused

I have created a dialog with 2 "pages" in GumpStudio. Page 0, 1 and 2.

I know page 0 is effectively background for the whole dialog, and Page 1 is the "start" page for the dialog.

I have 1 button on Page 1 and 1 button on Page 2. The idea is that Page 1 button opens page 2, page 2 button goes back to page 1. Like a forward/backwards button.

ON=0 // PAGE 1 BUTTON
SRC.DIALOG d_resources 2 //This seems to work
return 1

ON=1 //PAGE 2 button
SRC.DIALOG d_resources 1 //This seems to work also
return 1

However, despite "noclose" not being set, if I type the command to call the dialog at page 1 and then right click, it opens page 2. If i right click that it just stays there when it should close?




Also, the "x, y" part of the dialog seems to make no difference what so ever?

this is the bit i mean...

[DIALOG d_whatever]
50, 50 <-----------------------

I can set this to 0, 0 or 500, 500 and it doesn't change the location of the dialog when it pops up. Any ideas?

Thanks all


RE: dialog pages - darksun84 - 08-11-2014 03:17 AM

Button 0 is "fired" when you are trying to close the dialog, no matter the page you are in Smile

So when you are in page 2 and right click the dialog, button 0 fires and page 2 is displayed again.


RE: dialog pages - richm - 08-11-2014 06:35 AM

(08-11-2014 03:17 AM)darksun84 Wrote:  Button 0 is "fired" when you are trying to close the dialog, no matter the page you are in Smile

So when you are in page 2 and right click the dialog, button 0 fires and page 2 is displayed again.


Ah right ok so that makes sense.
I guess then all my code goes on button 1 then... ?

So how can i check to see what page is open... is there a simple way or should i incorporate some tags into it and check on those? Or should i be working with ON=1 and ON=2? :/

Cheers


RE: dialog pages - darksun84 - 08-11-2014 06:58 AM

try with on = 1 and on on = 2 Big Grin


RE: dialog pages - richm - 08-11-2014 07:12 AM

Ah thanks

had to also change the button code to "BUTTON X Y ID ID 1 0 1" and "BUTTON X Y ID ID 1 0 2" from "BUTTON X Y ID ID 1 0 0" and "BUTTON X Y ID ID 1 0 1"as well but is now working Smile

Its been a long time since i made anything Big Grin


RE: dialog pages - eberk - 08-11-2014 10:15 AM

why wont u just try to change them like
"BUTTON X Y ID ID 0 1 0" and "BUTTON X Y ID ID 0 2 0" without button id u can use "page" parameter in BUTTON


RE: dialog pages - Coruja - 08-11-2014 10:41 AM

the sphere always send all dialog pages to the client, you just need to make it change the page using "BUTTON x y id id 0 2 0", in other words, these numbers means:
0: there's no real button action (you cant use ON=2, ON=3, etc), since there's no action, sphere will automatically define that button as an "page button"
2: this will open page 2
0: as I said before, the button doesn't have a real action, so it doesnt need a tag number to use ON=2, ON=3, etc

you can open dialogs directly on a specific page using DIALOG d_something 2 too, this will open the dialog directly on page 2, but it's only recommended to open the dialog, not to change pages if the dialog is already open. If you change pages using this, sphere will send the entire dialog again to the client everytime you hit the button. If you use the first method above, the client can change the dialog page itself without need to reload the dialog (this will make it load faster)


RE: dialog pages - richm - 08-11-2014 06:09 PM

thanks for the advice Coruja & eberk. It was only a small script so the way its done should be ok.

Ill try your method on what i am currently working on as theres significantly more pages Confused no doubt ill be back on here soon for help Big Grin