Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //:://////////////////////////////////////////////////
- //:: GUI_TB_SCRY_GATHER
- //:: filename: gui_tb_scry_gather
- //:://////////////////////////////////////////////////
- /*
- Script fired from PC Scry GUI which populates
- the scry list and regulates what is displayed.
- */
- //:://////////////////////////////////////////////////
- //:: Created By: tigerbomb
- //:: Created On: 07/2011
- //:://////////////////////////////////////////////////
- #include "tb_scry_inc"
- void main()
- {
- //:: DECLARATIONS
- //: List and GUI data
- string sScreenName = "TB_SCRY_PANEL";
- string sListBox = "TB_SCRY_LIST";
- int iListTotal = 0; int iListVisible = 0; string sListTotals;
- //: Viewer/User Data
- object oViewer = OBJECT_SELF;
- string sViewerArea = AreaRename(GetName(GetArea(oViewer)));
- string sFilter = GetStringLowerCase(GetLocalString(oViewer,"Scry_Filter"));
- //int iIsViewerDM = GetIsDM(oViewer);
- //: Player/Display Data
- object oPlayer;
- string sPCBasicName, sPCName, sPCLetter, sPlayerName, sPCArea, sPCLevel;
- int iPCStatus; string sPCStatus = "Ready";
- int iHide, iDisplay;
- int iCount; string sLetter;
- string sRow, sTextFields, sTextCompare;
- /*
- //::: MAIN LOOP
- //CLEAR
- ClearListBox(oViewer,sScreenName,sListBox);
- //:: DM SECTION
- if(GetIsDM(oViewer)){
- //Cycle thru the 26 letters and display in order
- for(iCount=1; iCount<=26; iCount++){
- //Get letter to check for
- sLetter = TB_GetAlphaFromInt(iCount);
- //Get first player in list
- oPlayer = GetFirstPC();
- //Cycle thru Player list
- while (GetIsObjectValid(oPlayer)){
- //Get the character's name
- sPCBasicName = GetName(oPlayer);
- //Check for current letter in name
- sPCLetter = GetStringUpperCase(TB_FindFirstAlpha(sPCBasicName));
- //If first letter is not what we are looking for, do nothing this round.
- if(sPCLetter!=sLetter){}
- else{ //If first letter is what we are looking for:
- iListTotal++; //increment total player number from list
- iHide=0;
- sTextFields = TB_GetDisplayedText(oPlayer, oViewer, iHide, TRUE);
- //Check for filter text and display if appropriate
- if(sFilter != ""){
- //Get info to compare
- sTextCompare = TB_GetCheckablePlayerInfo(oPlayer, iHide);
- //if filter text not found, do nothing.
- if(FindSubString(sTextCompare, sFilter,0) == -1){}
- //otherwise display info
- else{
- iListVisible++; //increment number of displayed players
- sRow = "ScryRow"+IntToString(iListVisible);
- //Display info in the list.
- AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
- }//End ELSE (Filter Check)
- }//End IF (Filter Exists Check)
- else{
- iListVisible++; //increment number of displayed players
- sRow = "ScryRow"+IntToString(iListVisible);
- //Display info in the list.
- AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
- }//End ELSE (Filter Exists Check)
- } //End ELSE (Alpha Check)
- //Get the next player in list
- oPlayer = GetNextPC();
- } //End WHILE
- } //End FOR
- //Update and display number of players shown and total.
- sListTotals = IntToString(iListVisible) + " / " + IntToString(iListTotal);
- SetGUIObjectText(oViewer,sScreenName,"TB_SCRY_TOTALS",-1,sListTotals);
- }//End DM SECTION
- //:: PC SECTION
- else{
- //Cycle thru the 26 letters and display in order
- for(iCount=1; iCount<=26; iCount++){
- //Get letter to check for
- sLetter = TB_GetAlphaFromInt(iCount);
- //Get first player in list
- oPlayer = GetFirstPC();
- //Cycle thru Player list
- while (GetIsObjectValid(oPlayer)){
- //Get the character's name
- sPCBasicName = GetName(oPlayer);
- //Check for current letter in name
- sPCLetter = GetStringUpperCase(TB_FindFirstAlpha(sPCBasicName));
- //If first letter is not what we are looking for, do nothing this round.
- if(sPCLetter!=sLetter){}
- else{ //If first letter is what we are looking for:
- iListTotal++; //increment total player number from list
- if(GetIsDM(oPlayer)){} //do nothing if player is a DM.
- else{
- //Get Hide preferences
- iHide = GetLocalInt(oPlayer,"Scry_Hide");
- if(iHide == 1){} //if player is outright hidden, do nothing.
- //::: MAIN LOOP FOR CHARACTERS THAT SHOULD DISPLAY UNLESS FILTERED OUT :::
- else{
- sTextFields = TB_GetDisplayedText(oPlayer, oViewer, iHide, FALSE);
- //Check for filter text and display if appropriate
- if(sFilter != ""){
- //Get info to compare
- sTextCompare = TB_GetCheckablePlayerInfo(oPlayer, iHide);
- //if filter text not found, do nothing.
- if(FindSubString(sTextCompare, sFilter,0) == -1){}
- //otherwise display info
- else{
- iListVisible++; //increment number of displayed players
- sRow = "ScryRow"+IntToString(iListVisible);
- //Display info in the list.
- AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
- }//End ELSE (Filter Check)
- }//End IF (Filter Exists Check)
- else{
- iListVisible++; //increment number of displayed players
- sRow = "ScryRow"+IntToString(iListVisible);
- //Display info in the list.
- AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
- }//End ELSE (Filter Exists Check)
- }//End ELSE (HIDE ALL Check)
- }//End ELSE (DM Check)
- } //End ELSE (Alpha Check)
- //Get the next player in list
- oPlayer = GetNextPC();
- } //End WHILE
- } //End FOR
- //Update and display number of players shown and total.
- sListTotals = IntToString(iListVisible) + " / " + IntToString(iListTotal);
- SetGUIObjectText(oViewer,sScreenName,"TB_SCRY_TOTALS",-1,sListTotals);
- }//End ELSE PC SECTION
- }//END MAIN
- */
- //Rasael - removed alphabetic sorting because of too many instructions error and associated CPU Cost
- //::: MAIN LOOP
- //CLEAR
- ClearListBox(oViewer,sScreenName,sListBox);
- //:: DM SECTION
- if(GetIsDM(oViewer)){
- //Get first player in list
- oPlayer = GetFirstPC();
- //Cycle thru Player list
- while (GetIsObjectValid(oPlayer)){
- iListTotal++; //increment total player number from list
- iHide=0;
- sTextFields = TB_GetDisplayedText(oPlayer, oViewer, iHide, TRUE);
- //Check for filter text and display if appropriate
- if(sFilter != ""){
- //Get info to compare
- sTextCompare = TB_GetCheckablePlayerInfo(oPlayer, iHide);
- //if filter text not found, do nothing.
- if(FindSubString(sTextCompare, sFilter,0) == -1){}
- //otherwise display info
- else{
- iListVisible++; //increment number of displayed players
- sRow = "ScryRow"+IntToString(iListVisible);
- //Display info in the list.
- AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
- }//End ELSE (Filter Check)
- }//End IF (Filter Exists Check)
- else{
- iListVisible++; //increment number of displayed players
- sRow = "ScryRow"+IntToString(iListVisible);
- //Display info in the list.
- AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
- }//End ELSE (Filter Exists Check)
- //Get the next player in list
- oPlayer = GetNextPC();
- } //End WHILE
- //Update and display number of players shown and total.
- sListTotals = IntToString(iListVisible) + " / " + IntToString(iListTotal);
- SetGUIObjectText(oViewer,sScreenName,"TB_SCRY_TOTALS",-1,sListTotals);
- }//End DM SECTION
- //:: PC SECTION
- else{
- //Get letter to check for
- sLetter = TB_GetAlphaFromInt(iCount);
- //Get first player in list
- oPlayer = GetFirstPC();
- //Cycle thru Player list
- while (GetIsObjectValid(oPlayer)){
- iListTotal++; //increment total player number from list
- if(GetIsDM(oPlayer)){} //do nothing if player is a DM.
- else{
- //Get Hide preferences
- iHide = GetLocalInt(oPlayer,"Scry_Hide");
- if(iHide == 1){} //if player is outright hidden, do nothing.
- //::: MAIN LOOP FOR CHARACTERS THAT SHOULD DISPLAY UNLESS FILTERED OUT :::
- else{
- sTextFields = TB_GetDisplayedText(oPlayer, oViewer, iHide, FALSE);
- //Check for filter text and display if appropriate
- if(sFilter != ""){
- //Get info to compare
- sTextCompare = TB_GetCheckablePlayerInfo(oPlayer, iHide);
- //if filter text not found, do nothing.
- if(FindSubString(sTextCompare, sFilter,0) == -1){}
- //otherwise display info
- else{
- iListVisible++; //increment number of displayed players
- sRow = "ScryRow"+IntToString(iListVisible);
- //Display info in the list.
- AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
- }//End ELSE (Filter Check)
- }//End IF (Filter Exists Check)
- else{
- iListVisible++; //increment number of displayed players
- sRow = "ScryRow"+IntToString(iListVisible);
- //Display info in the list.
- AddListBoxRow(oViewer,sScreenName,sListBox,sRow,sTextFields,"","","");
- }//End ELSE (Filter Exists Check)
- }//End ELSE (HIDE ALL Check)
- }//End ELSE (DM Check)
- //Get the next player in list
- oPlayer = GetNextPC();
- } //End WHILE
- //Update and display number of players shown and total.
- sListTotals = IntToString(iListVisible) + " / " + IntToString(iListTotal);
- SetGUIObjectText(oViewer,sScreenName,"TB_SCRY_TOTALS",-1,sListTotals);
- }//End ELSE PC SECTION
- }//END MAIN
- /*
- } */
Add Comment
Please, Sign In to add comment