Jump to content
  • 0

help with party broadcaster npc, else not being read


drifterxxxx2

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  83
  • Reputation:   3
  • Joined:  10/22/17
  • Last Seen:  

Hi

I'm trying to modify @Emistry's non spammable broadcaster

It supose to ask player for job and level and then announce it

Restrictions are the job must be only letters, less than 25 characters and level must be from 1-175 

This is what I've manage to write so far, it is not yet complete, but i'm stuck because it's not reading the 'else'

Not sure why.. not sure of anything actually xD .. all kind of tips are welcome!

//Emistry's Non Spammable Ver
prontera,147,165,5	script	Broadcaster NPC	503,{
set .name$,"[Broadcaster]";
set .Minutes,1;
if( .DelayTime <= gettimetick(2)) {
        mes .name$;
        mes "hi ^0000FF"+strcharinfo(0)+"^000000 .";
        mes "do you want to look for party for ^FF000050.000^000000z.?";
        mes "remember, you agree to follow the ^5533AArules^000000.\n";
        mes "for more information please visit us at.";
        switch( select("yes","nope")) {
                case 1:
                        next;
                        mes .name$;
                        mes "what is your ^FF0000job^000000?\n";
                        mes "you can also add your friends here.";
                        input(.Message1$);
                        if (getstrlen(.Message1$) < 25) {
                                next;
                                mes .name$;
                                mes "and your level?\n";
                                mes "numbers 1-175";
                                input(.Message2);
                        }
                        if (.Message2 > 1) || (.Message2 < 175) {
                                close2;
                                set .DelayTime,gettimetick(2) + ( .Minutes * 1 );
                                set zeny,zeny-100000;
                                announce "["+strcharinfo(0)+"] is looking for party to play as "+.Message1$+" level "+.Message2+". please send him a message",0,0x007799,14;
                                end;
                        } else {
                                next;
                                mes .name$;
                                mes "message not valid.";
                                mes "must be less than 25 characters and from 1-175.";
                                mes "try again.";
                                close;
                        }
                case 2:
                        next;
                        mes .name$;
                        mes "come back anytime.";
                        close;
        }
} else if( .DelayTime > gettimetick(2) ){
        set .last,.DelayTime - gettimetick(2);
        set .@min,  .last % (24*60*60) % (60*60) / (60);
        set .@sec,  .last % (24*60*60) % (60*60) % (60);
        mes "[Broadcaster]";
        mes "cant send another meesage in "+.@min+" minutes "+.@sec+" secs";
}
close;
}

 

Thank you for your time

/thx 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

prontera,147,165,5	script	Broadcaster NPC	503,{
set .name$,"[Broadcaster]";
set .Minutes,1;
if( .DelayTime > gettimetick(2) ){
        set .last,.DelayTime - gettimetick(2);
        set .@min,  .last % (24*60*60) % (60*60) / (60);
        set .@sec,  .last % (24*60*60) % (60*60) % (60);
        mes "[Broadcaster]";
        mes "cant send another meesage in "+.@min+" minutes "+.@sec+" secs";
}
else {
        mes .name$;
        mes "hi ^0000FF"+strcharinfo(0)+"^000000 .";
        mes "do you want to look for party for ^FF000050.000^000000z.?";
        mes "remember, you agree to follow the ^5533AArules^000000.\n";
        mes "for more information please visit us at.";
        switch( select("yes","nope")) {
                case 1:
                        next;
                        mes .name$;
                        mes "what is your ^FF0000job^000000?\n";
                        mes "you can also add your friends here.";
                        input(.Message1$);
                        if (getstrlen(.Message1$) < 25) {
                                next;
                                mes .name$;
                                mes "and your level?\n";
                                mes "numbers 1-175";
                                input(.Message2);
                        }
                        if (.Message2 > 1) || (.Message2 < 175) {
                                close2;
                                set .DelayTime,gettimetick(2) + ( .Minutes * 1 );
                                set zeny,zeny-100000;
                                announce "["+strcharinfo(0)+"] is looking for party to play as "+.Message1$+" level "+.Message2+". please send him a message",0,0x007799,14;
                                end;
                        } else {
                                next;
                                mes .name$;
                                mes "message not valid.";
                                mes "must be less than 25 characters and from 1-175.";
                                mes "try again.";
                                close;
                        }
                case 2:
                        next;
                        mes .name$;
                        mes "come back anytime.";
                        close;
        }
}
close;
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  83
  • Reputation:   3
  • Joined:  10/22/17
  • Last Seen:  

Ty for your response

The issue, tho, was in the input command which is not very well explained in doc/script_commands.txt, at least for snail slow learners like me xD

I tried this

input .Message2,0,176; // so i guess it only counts positives, and works like range
if (.Message2 == 0) {// excluded 0 not a valid char level
	next;
	mes "not valid"; 
	mes "try again";
	close;
} else if (.Message2 > 175) {
	next;
	mes "not valid";
	mes "must be level 1-175";
	close;
} else {
	mes "here is your message";
	close2;
	//etc 

so overall it works but I still didn't fully understand how input works I hope I got it right

Maybe will help other people 

/thx 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...