Guest User

Untitled

a guest
May 26th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.60 KB | None | 0 0
  1. //:://////////////////////////////////////////////////
  2. //:: GUI_TB_SCRY_GATHER
  3. //:: filename: gui_tb_scry_gather
  4. //:://////////////////////////////////////////////////
  5. /*
  6. Script fired from PC Scry GUI which populates
  7. the scry list and regulates what is displayed.
  8. */
  9. //:://////////////////////////////////////////////////
  10. //:: Created By: tigerbomb
  11. //:: Created On: 07/2011
  12. //:://////////////////////////////////////////////////
  13.  
  14. #include "tb_scry_inc"
  15.  
  16. void main()
  17. {
  18. //:: DECLARATIONS
  19.  
  20. //: List and GUI data
  21. string sScreenName = "TB_SCRY_PANEL";
  22. string sListBox = "TB_SCRY_LIST";
  23. int iListTotal = 0; int iListVisible = 0; string sListTotals;
  24.  
  25. //: Viewer/User Data
  26. object oViewer = OBJECT_SELF;
  27. string sViewerArea = AreaRename(GetName(GetArea(oViewer)));
  28. string sFilter = GetStringLowerCase(GetLocalString(oViewer,"Scry_Filter"));
  29. //int iIsViewerDM = GetIsDM(oViewer);
  30.  
  31. //: Player/Display Data
  32. object oPlayer;
  33. string sPCBasicName, sPCName, sPCLetter, sPlayerName, sPCArea, sPCLevel;
  34. int iPCStatus; string sPCStatus = "Ready";
  35. int iHide, iDisplay;
  36. int iCount; string sLetter;
  37. string sRow, sTextFields, sTextCompare;
  38. /*
  39. //::: MAIN LOOP
  40.  
  41. //CLEAR
  42. ClearListBox(oViewer,sScreenName,sListBox);
  43.  
  44. //:: DM SECTION
  45. if(GetIsDM(oViewer)){
  46.  
  47. //Cycle thru the 26 letters and display in order
  48. for(iCount=1; iCount<=26; iCount++){
  49.  
  50. //Get letter to check for
  51. sLetter = TB_GetAlphaFromInt(iCount);
  52. //Get first player in list
  53. oPlayer = GetFirstPC();
  54. //Cycle thru Player list
  55. while (GetIsObjectValid(oPlayer)){
  56.  
  57. //Get the character's name
  58. sPCBasicName = GetName(oPlayer);
  59. //Check for current letter in name
  60. sPCLetter = GetStringUpperCase(TB_FindFirstAlpha(sPCBasicName));
  61. //If first letter is not what we are looking for, do nothing this round.
  62. if(sPCLetter!=sLetter){}
  63. else{ //If first letter is what we are looking for:
  64.  
  65. iListTotal++; //increment total player number from list
  66. iHide=0;
  67. sTextFields = TB_GetDisplayedText(oPlayer, oViewer, iHide, TRUE);
  68.  
  69. //Check for filter text and display if appropriate
  70. if(sFilter != ""){
  71. //Get info to compare
  72. sTextCompare = TB_GetCheckablePlayerInfo(oPlayer, iHide);
  73. //if filter text not found, do nothing.
  74. if(FindSubString(sTextCompare, sFilter,0) == -1){}
  75. //otherwise display info
  76. else{
  77. iListVisible++; //increment number of displayed players
  78. sRow = "ScryRow"+IntToString(iListVisible);
  79. //Display info in the list.
  80. AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
  81. }//End ELSE (Filter Check)
  82. }//End IF (Filter Exists Check)
  83. else{
  84. iListVisible++; //increment number of displayed players
  85. sRow = "ScryRow"+IntToString(iListVisible);
  86. //Display info in the list.
  87. AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
  88. }//End ELSE (Filter Exists Check)
  89. } //End ELSE (Alpha Check)
  90. //Get the next player in list
  91. oPlayer = GetNextPC();
  92. } //End WHILE
  93. } //End FOR
  94. //Update and display number of players shown and total.
  95. sListTotals = IntToString(iListVisible) + " / " + IntToString(iListTotal);
  96. SetGUIObjectText(oViewer,sScreenName,"TB_SCRY_TOTALS",-1,sListTotals);
  97. }//End DM SECTION
  98.  
  99.  
  100. //:: PC SECTION
  101. else{
  102.  
  103. //Cycle thru the 26 letters and display in order
  104. for(iCount=1; iCount<=26; iCount++){
  105.  
  106. //Get letter to check for
  107. sLetter = TB_GetAlphaFromInt(iCount);
  108. //Get first player in list
  109. oPlayer = GetFirstPC();
  110. //Cycle thru Player list
  111. while (GetIsObjectValid(oPlayer)){
  112.  
  113. //Get the character's name
  114. sPCBasicName = GetName(oPlayer);
  115. //Check for current letter in name
  116. sPCLetter = GetStringUpperCase(TB_FindFirstAlpha(sPCBasicName));
  117. //If first letter is not what we are looking for, do nothing this round.
  118. if(sPCLetter!=sLetter){}
  119. else{ //If first letter is what we are looking for:
  120.  
  121. iListTotal++; //increment total player number from list
  122.  
  123. if(GetIsDM(oPlayer)){} //do nothing if player is a DM.
  124. else{
  125. //Get Hide preferences
  126. iHide = GetLocalInt(oPlayer,"Scry_Hide");
  127.  
  128. if(iHide == 1){} //if player is outright hidden, do nothing.
  129. //::: MAIN LOOP FOR CHARACTERS THAT SHOULD DISPLAY UNLESS FILTERED OUT :::
  130. else{
  131. sTextFields = TB_GetDisplayedText(oPlayer, oViewer, iHide, FALSE);
  132.  
  133.  
  134. //Check for filter text and display if appropriate
  135. if(sFilter != ""){
  136. //Get info to compare
  137. sTextCompare = TB_GetCheckablePlayerInfo(oPlayer, iHide);
  138. //if filter text not found, do nothing.
  139. if(FindSubString(sTextCompare, sFilter,0) == -1){}
  140. //otherwise display info
  141. else{
  142. iListVisible++; //increment number of displayed players
  143. sRow = "ScryRow"+IntToString(iListVisible);
  144. //Display info in the list.
  145. AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
  146. }//End ELSE (Filter Check)
  147. }//End IF (Filter Exists Check)
  148. else{
  149. iListVisible++; //increment number of displayed players
  150. sRow = "ScryRow"+IntToString(iListVisible);
  151. //Display info in the list.
  152. AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
  153. }//End ELSE (Filter Exists Check)
  154. }//End ELSE (HIDE ALL Check)
  155. }//End ELSE (DM Check)
  156. } //End ELSE (Alpha Check)
  157.  
  158. //Get the next player in list
  159. oPlayer = GetNextPC();
  160. } //End WHILE
  161. } //End FOR
  162. //Update and display number of players shown and total.
  163. sListTotals = IntToString(iListVisible) + " / " + IntToString(iListTotal);
  164. SetGUIObjectText(oViewer,sScreenName,"TB_SCRY_TOTALS",-1,sListTotals);
  165. }//End ELSE PC SECTION
  166. }//END MAIN
  167. */
  168.  
  169. //Rasael - removed alphabetic sorting because of too many instructions error and associated CPU Cost
  170.  
  171. //::: MAIN LOOP
  172.  
  173. //CLEAR
  174. ClearListBox(oViewer,sScreenName,sListBox);
  175.  
  176. //:: DM SECTION
  177. if(GetIsDM(oViewer)){
  178.  
  179. //Get first player in list
  180. oPlayer = GetFirstPC();
  181. //Cycle thru Player list
  182. while (GetIsObjectValid(oPlayer)){
  183.  
  184. iListTotal++; //increment total player number from list
  185. iHide=0;
  186. sTextFields = TB_GetDisplayedText(oPlayer, oViewer, iHide, TRUE);
  187.  
  188. //Check for filter text and display if appropriate
  189. if(sFilter != ""){
  190. //Get info to compare
  191. sTextCompare = TB_GetCheckablePlayerInfo(oPlayer, iHide);
  192. //if filter text not found, do nothing.
  193. if(FindSubString(sTextCompare, sFilter,0) == -1){}
  194. //otherwise display info
  195. else{
  196. iListVisible++; //increment number of displayed players
  197. sRow = "ScryRow"+IntToString(iListVisible);
  198. //Display info in the list.
  199. AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
  200. }//End ELSE (Filter Check)
  201. }//End IF (Filter Exists Check)
  202. else{
  203. iListVisible++; //increment number of displayed players
  204. sRow = "ScryRow"+IntToString(iListVisible);
  205. //Display info in the list.
  206. AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
  207. }//End ELSE (Filter Exists Check)
  208. //Get the next player in list
  209. oPlayer = GetNextPC();
  210. } //End WHILE
  211. //Update and display number of players shown and total.
  212. sListTotals = IntToString(iListVisible) + " / " + IntToString(iListTotal);
  213. SetGUIObjectText(oViewer,sScreenName,"TB_SCRY_TOTALS",-1,sListTotals);
  214. }//End DM SECTION
  215.  
  216.  
  217. //:: PC SECTION
  218. else{
  219.  
  220. //Get letter to check for
  221. sLetter = TB_GetAlphaFromInt(iCount);
  222. //Get first player in list
  223. oPlayer = GetFirstPC();
  224. //Cycle thru Player list
  225. while (GetIsObjectValid(oPlayer)){
  226.  
  227. iListTotal++; //increment total player number from list
  228.  
  229. if(GetIsDM(oPlayer)){} //do nothing if player is a DM.
  230. else{
  231. //Get Hide preferences
  232. iHide = GetLocalInt(oPlayer,"Scry_Hide");
  233.  
  234. if(iHide == 1){} //if player is outright hidden, do nothing.
  235. //::: MAIN LOOP FOR CHARACTERS THAT SHOULD DISPLAY UNLESS FILTERED OUT :::
  236. else{
  237. sTextFields = TB_GetDisplayedText(oPlayer, oViewer, iHide, FALSE);
  238.  
  239.  
  240. //Check for filter text and display if appropriate
  241. if(sFilter != ""){
  242. //Get info to compare
  243. sTextCompare = TB_GetCheckablePlayerInfo(oPlayer, iHide);
  244. //if filter text not found, do nothing.
  245. if(FindSubString(sTextCompare, sFilter,0) == -1){}
  246. //otherwise display info
  247. else{
  248. iListVisible++; //increment number of displayed players
  249. sRow = "ScryRow"+IntToString(iListVisible);
  250. //Display info in the list.
  251. AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
  252. }//End ELSE (Filter Check)
  253. }//End IF (Filter Exists Check)
  254. else{
  255. iListVisible++; //increment number of displayed players
  256. sRow = "ScryRow"+IntToString(iListVisible);
  257. //Display info in the list.
  258. AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
  259. }//End ELSE (Filter Exists Check)
  260. }//End ELSE (HIDE ALL Check)
  261. }//End ELSE (DM Check)
  262. //Get the next player in list
  263. oPlayer = GetNextPC();
  264. } //End WHILE
  265. //Update and display number of players shown and total.
  266. sListTotals = IntToString(iListVisible) + " / " + IntToString(iListTotal);
  267. SetGUIObjectText(oViewer,sScreenName,"TB_SCRY_TOTALS",-1,sListTotals);
  268. }//End ELSE PC SECTION
  269. }//END MAIN
  270.  
  271. /*
  272.  
  273.  
  274.  
  275.  
  276. } */
Add Comment
Please, Sign In to add comment