viewing paste Survey NPC | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
//===== rAthena Script =======================================
//= Survey NPC
//===== By: ==================================================
//= Zafer
//===== Modified By: =========================================
// = Mysterious
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
//= rAthena SVN 
//===== Description: =========================================
//= Allow players to vote on a question through a Survey.
//===== Other Information: ===================================
// Gamemasters can create topics/questions while players are
// able to vote on such a question/topic. 
//===== Additional Comments: =================================
//= v1.0 - Intitial Re-release [Mysterious]
//= v1.1 - Language structures [Mysterious]
//= v1.2 - Added divisions [Mysterious]
//= v1.3 - Added proper information [Mysterious]
//= v1.4 - Structured the script better [Mysterious]
//= v1.5 - Fixed German wordings? [Mysterious]
//============================================================
prontera,158,168,5  script  Survey  435,{
 
set @np$,"[ ^7401DFSandra^000000 ]";
if ( getgmlevel() == 99 ) {
if ( $survey_running ) {
switch ( select ( "- Survey Result","- Delete Survey" ) ) {
 
        case 1:
            mes "- ^8A0808"+$survey_title$+"^000000 -";
            mes $survey_question$;
            mes "";
            for ( set @a,0; @a < getarraysize($survey_option$); set @a,@a+1 ) {
            mes "^0404B4"+$survey_option$[@a]+"^000000 - ^8A0808"+$survey_option_votes[@a]+"^000000 Vote/s";
            }
            close;
         case 2:
                mes @np$;
                mes "Are you sure that you want to delete the survey: ";
                mes "";
                mes "- ^8A0808"+$survey_title$+"^000000 -";
                next;
                if ( select ( "No.","Yes, pretty sure." ) == 1 ) { close; }
                set $survey_running,0;
                set $survey_title$,"^8A0808NOT SET^000000"; 
                set $survey_question$,"";
                set @question_set$,"^8A0808NOT SET^000000";
                for ( set @b,0; @b <= getarraysize($survey_option$)+2; set @b,@b+1 ) {
                set $survey_option$[@b],"";
                set $survey_option_votes[@b],0;
                }
                mes @np$;
                mes "The survey has been deleted successfully.";
                close;
                }
                
        } // Ending bracket to Survey running
        if ( select ( "- Exit","- Create Survey" ) == 1 ) { close; }
        set $survey_title$,"^8A0808NOT SET^000000"; 
        set $survey_question$,"";
        set @question_set$,"^8A0808NOT SET^000000";
        for ( set @b,0; @b <= getarraysize($survey_option$); set @b,@b+1 ) {
        set $survey_option$[@b],"";}
        while ( 1 ) {
            set @subtract,2;
            if ( getarraysize($survey_option$) > 1 ) && ($survey_title$ != "NOT SET") && ( $survey_question$ != "NOT SET") { 
                set @menu_string$,"- Complete";
                set @menu_string$,@menu_string$+":Title [^04B404"+$survey_title$+"^000000]";
                set @subtract,3;
            } else {
                set @menu_string$,"Title [^04B404"+$survey_title$+"^000000]";
                }
            set @menu_string$,@menu_string$+":Question ["+@question_set$+"]";
            for ( set @a,0; @a < getarraysize($survey_option$); set @a,@a+1 ) {
                set @menu_string$,@menu_string$ +":    "+(@a+1)+". ^0404B4"+$survey_option$[@a]+"^000000";
                }
            set @menu_string$,@menu_string$ +":^0AE143+^000000 Add Option";
            mes @np$;
            mes "Do your Survey settings.";
            next;
            set @selected, select ( @menu_string$)-@subtract;
                if ( @selected == -2 ) {
                    mes @np$;
                    mes "Title:"; 
                    mes "^04B404"+$survey_title$+"^000000";
                    mes "Question:";
                    mes "^04B404"+$survey_question$+"^000000";
                    mes "Options:";
                    for ( set @b,0; @b <= getarraysize($survey_option$)-1; set @b,@b+1 ) {
                    mes (@b+1)+". ^0404B4"+$survey_option$[@b]+"^000000";
                    }
                next;
                if ( select ( "No, it is not correct.","Yes, it is correct." ) == 2 ) {
                    mes @np$;
                    mes "Your Survey started successfully";
                    set $vote_id,$vote_id+1;
                    set $survey_running,1;
                    getmapxy(@map$,@x,@y,1);
                    announce "Please see the Survey NPC in "+@map$+" and give us your Vote.",bc_all;
                    close;
                    }
                }
 
            if ( @selected == 0) { 
            mes @np$;
            mes "Type in the survey leading question.";
            mes "";
            mes "Current:";
            if ( $survey_question$ == "" ) {
            mes "^8A0808NOT SET^000000";
                } else {
                    mes "^04B404"+$survey_question$+"^000000"; }
                    next;
                    input $survey_question$;
                    set @question_set$,"^0AE143SET^000000";
                    }
 
            if ( @selected == -1) { 
                mes @np$;
                mes "Type in the survey title.";
                mes "";
                mes "Current:";
                mes "^04B404"+$survey_title$+"^000000";
                next;
                input $survey_title$;
                }
 
            if ( @selected == getarraysize($survey_option$)+1) { 
            mes @np$;
            mes "Type in a new option.";
            next;
            input $survey_option$[@selected-1];
            set @selected,@selected+1;
            }
 
        if ( @selected >= 1 ) && ( @selected < getarraysize($survey_option$)+1) {
 
        set @selected2, select ( "- Back","- Change","- Delete" );
 
          if ( @selected2 == 2 ) {
            mes @np$;
            mes "Type in the new option:";
            mes "";
            mes "Current:";
            mes "^0404B4"+$survey_option$[@selected-1]+"^000000";
            next;
            input $survey_option$[@selected-1];
        }
          if ( @selected2 == 3) {
 
            for ( set @a,@selected-1; @a < getarraysize($survey_option$)-1; set @a,@a+1 ) {
            set $survey_option$[@a],$survey_option$[@a+1];
        }
            set $survey_option$[@a],"";
        }
    }
}
 
end;
// GM Settings End
} else {
// Player view
    if ( !$survey_running ) { mes @np$; mes "There is no survey currently running."; close; }
    if ( !getd("##survey_id_"+$vote_id) ) {
        mes @np$;
        mes "Please choose an Option for the following Survey:";
        next;
        while (1) {
        mes "- ^8A0808"+$survey_title$+"^000000 -";
        mes "";
        mes $survey_question$;
        set @menu_string$,"";
        for ( set @a,0; @a < getarraysize($survey_option$); set @a,@a+1 ) {
        set @menu_string$,@menu_string$ +":"+(@a+1)+". ^0404B4"+$survey_option$[@a]+"^000000";
        }
    next;
    set @select, select ( @menu_string$ )-2;
    mes @np$;
    mes "Are you positive with your choice?";
    mes "";
    mes "- ^0404B4"+$survey_option$[@select]+"^000000 -";
    next;
    if ( select ( "Nope","Yeah" ) == 2 ) { 
        set getd("##survey_id_"+($vote_id-1)),0;
        set getd("##survey_id_"+$vote_id),1;
        set $survey_option_votes[@select],$survey_option_votes[@select]+1;
        mes @np$;
        mes "Thank you for your Vote.";
        next;
        break;
        }
    }
}
    if ( getd("##survey_id_"+$vote_id) ) {
        mes "- ^8A0808"+$survey_title$+"^000000 -";
        mes $survey_question$;
        mes "";
        for ( set @a,0; @a < getarraysize($survey_option$); set @a,@a+1 ) {
        mes "^0404B4"+$survey_option$[@a]+"^000000 - ^8A0808"+$survey_option_votes[@a]+"^000000 Vote/s";
        }
        close;
        }
    }
}// Ending bracket
Viewed 931 times, submitted by Guest.