The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Dynamic Dialogs?
Author Message
Reflex
Journeyman
*

Posts: 130
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #1
Help with Dynamic Dialogs?
Hello, Thanks in Advance.. and to those who feel like helping please give in-depth answers explaining your post.

1. How do I make these dynamic where they re-size themselves dependent upon how many commands are available? or something like that.. without having to always manually re-size dialog backgrounds?

resizepic 12 14 5054 203 200
gumppictiled 19 22 187 185 5124

2. How do I make a dialog recognize the page its on for example
Page 1 of 2 without manually typing in the numbers?

3. What is the best way to have the dialog load information in accordance to your plevel? Example. I would like players who click commands have "variable" commands listed. If Counselor clicks commands have it list only counselor commands and all of player's commands. Seers show seers commands and counselors and players commands?

dhtmlgump 75 26 175 100 0 0 <DEF.CENTER><DEF.BFONT_RED>Page 1 of 1<DEF.CENTER></BFONTE>

resizepic 12 14 5054 203 200
gumppictiled 19 22 187 185 5124

Code:
[DIALOG d_commands]
0,0
page 0
resizepic 12 14 5054 203 200
gumppictiled 19 22 187 185 5124
Group 0
radio 182 75 5541 5540 0 0
radio 182 98 5541 5540 0 0
gumppictiled 40 24 165 24 3504
dhtmlgump 75 26 175 100 0 0 <DEF.CENTER><DEF.BFONT_RED>Page 1 of 1<DEF.CENTER></BFONTE>
gumppictiled 20 49 159 24 3504
gumppictiled 20 74 159 24 3504
gumppictiled 20 99 159 24 3504
if <account.plevel> == 0
dhtmlgump 25 50 150 100 0 0 <DEF.CENTER><DEF.BFONT_LBLUE>Guest<DEF.CENTER></BFONTE>
elif <account.plevel> == 1
dhtmlgump 25 50 150 100 0 0 <DEF.CENTER><DEF.BFONT_LBLUE>Player<DEF.CENTER></BFONTE>
elif <account.plevel> == 2
dhtmlgump 25 50 150 100 0 0 <DEF.CENTER><DEF.BFONT_LBLUE>Counselor<DEF.CENTER></BFONTE>
elif <account.plevel> == 3
dhtmlgump 25 50 150 100 0 0 <DEF.CENTER><DEF.BFONT_LBLUE>Seer<DEF.CENTER></BFONTE>
elif <account.plevel> == 4
dhtmlgump 25 50 150 100 0 0 <DEF.CENTER><DEF.BFONT_LBLUE>Game Master<DEF.CENTER></BFONTE>
elif <account.plevel> == 5
dhtmlgump 25 50 150 100 0 0 <DEF.CENTER><DEF.BFONT_LBLUE>Developer<DEF.CENTER></BFONTE>
elif <account.plevel> == 6
dhtmlgump 25 50 150 100 0 0 <DEF.CENTER><DEF.BFONT_LBLUE>Administrator<DEF.CENTER></BFONTE>
elif <account.plevel> == 7
dhtmlgump 25 50 150 100 0 0 <DEF.CENTER><DEF.BFONT_LBLUE>Owner<DEF.CENTER></BFONTE>
else
dtext 25 50 0 Null
endif
dtext 25 75 0 ..E & .Emote
dtext 25 100 0 ..Help

[DIALOG d_commands text]
page # of #
Account Type
Option # 1

[DIALOG d_commands button]
04-29-2012 11:00 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #2
RE: Help with Dynamic Dialogs?
Quote:1. How do I make these dynamic where they re-size themselves dependent upon how many commands are available? or something like that.. without having to always manually re-size dialog backgrounds?

resizepic 12 14 5054 203 200
gumppictiled 19 22 187 185 5124

Try this:

resizepic 12 14 5054 <LOCAL.ResizepicWidth> <LOCAL.ResizepicHeight>
gumppictiled 19 22 <LOCAL.GumppictiledWidth> <LOCAL.GumppictiledHeight> 5124

Figuring out how to calculate those variables... that is the tricky part.
Quote:3. What is the best way to have the dialog load information in accordance to your plevel? Example. I would like players who click commands have "variable" commands listed. If Counselor clicks commands have it list only counselor commands and all of player's commands. Seers show seers commands and counselors and players commands?

dhtmlgump 75 26 175 100 0 0 <DEF.CENTER><DEF.BFONT_RED>Page 1 of 1<DEF.CENTER></BFONTE>

By Default, the sphere_admin.scp has some definitions for the PLEVELs:

Code:
[DEFNAME admin_strings]
// Titles for privilege levels
admin_plevel_0         "Guest"
admin_plevel_1         "Player"
admin_plevel_2         "Counselor"
admin_plevel_3         "Seer"
admin_plevel_4         "Game Master"
admin_plevel_5         "Developer"
admin_plevel_6         "Administrator"
admin_plevel_7         "Owner"

lets add a few more to make the code more readable...

Code:
// Titles for privilege levels
admin_plevel_Guest        0
admin_plevel_Player       1
admin_plevel_Counselor    2
admin_plevel_Seer         3
admin_plevel_GM           4
admin_plevel_Developer    5
admin_plevel_Admin        6
admin_plevel_Owner        7

So make some basic functions that check for the minimum PLEVEL for a given command... maybe like this:

Code:
[FUNCTION f_PLevelAtLeastGM]
IF (<ACCOUNT.PLEVEL> >= <DEF.admin_plevel_gm>)
   RETURN 1
ENDIF
RETURN 0

Then in the DIALOG itself, do stuff like this:

Code:
//dtext x y colour text
dtext 10 10 <QVAL <SRC.f_PLevelatLeastGM>?<DEF.color_snow>:<DEF.color_red1>> text that is white for GMs (or higher) and red for anyone less than GM

//a button (3) that is pressable only by GMs or higher:
//button x y gump_down gump_up is_pressable page id
button 0 10 2704  2705 <QVAL <SRC.f_PLevelatLeastGM>?1:0> 0 3
(This post was last modified: 04-30-2012 08:15 AM by RanXerox.)
04-30-2012 07:48 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)