Jump to content
  • 0

Mes Override


Litro Endemic

Question


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

I just want to override the mes if the states of the npc is no longer available without conditional check, but there is warning pop up on map-server console.

while setting state on variable to not longer available can do this it need extra check every continuation, but if there is multiple next or while on the script, it need multiple check after it, so how can I do it the clean or right way ??

protnera,230,273,0	script	test override	112,{
	attachnpctimer; initnpctimer;
	while(1) {
		mes "You are talking to this npc";
		next;
		select("-Yes");
	}
	close;

OnTimer15000:
	detachnpctimer;
	mes "15 Seconds have passed.";
	close;

}

warning pop up on map-server console

[Warning]: Unable to restore stack! Double continuation!
[Debug]: Previous script (lost):
[Debug]: Source (NPC): test override at prontera (230,273)
[Debug]: Current script:
[Debug]: Source (NPC): test override at prontera (230,273)

 

Edited by Litro Endemic
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

then shouldn't use time limit, just set another npc variable for it

prontera,150,185,0	script	test override	1_F_MARIA,{
	.@difficulty = 3; // official script only has 3 digits ... sux ... maximum is 9 btw
	if ( .start == 0 ) {
		if ( getgmlevel() != 99 ) {
			dispbottom "only GM can activate this event.";
			end;
		}
		F_ShuffleNumbers 1, 9, .@r, .@difficulty;
		for ( .@i = 0; .@i < .@difficulty; ++.@i )
			.guess += .@r[.@i] * (10 ** .@i); // change 10**.@i into pow(10,.@i) for rathena
		dispbottom "input this number -> "+ .guess;
		.start = 1;
		end;
	}
	else if ( .start == 1 ) {
		input .@num;
		if ( .start != 1 ) { // <--- THIS is what you need
			dispbottom "the guessing time has over";
			end;
		}
		if ( .@num != .guess ) {
			// Let's do some MATH !!
			if ( .@num < 10 ** (.@difficulty -1) || .@num >= 10 ** .@difficulty ) {
				dispbottom "Number input requirement has not been fulfilled. Please enter a "+ .@difficulty +" digit number.";
				end;
			}
			for ( .@i = 0; .@i < .@difficulty; ++.@i )
				.@n[.@i] = .@num / ( 10**.@i ) % 10;
			for ( .@i = 0; .@i < .@difficulty; ++.@i ) {
				if ( .@n[.@i] == 0 ) {
					dispbottom "Violation of number input parameter. Number 0 has been input.";
					end;
				}
				if ( countstr( .@num +"", .@n[.@i] +"" ) > 1 ) {
					dispbottom "Violation of number input parameter. Number has been input more than once.";
					end;
				}
			}
			for ( .@i = 0; .@i < .@difficulty; ++.@i ) {
				if ( compare( .guess +"", .@n[.@i] +"" ) )
					++.@has_number;
				if ( charat( .@num +"", .@i ) == charat( .guess +"", .@i ) )
					++.@correct_pos;
			}
			dispbottom "Your guess has "+ .@has_number +" digit of number that is on the answer, and "+ .@correct_pos +" digit having same position with the answer.";
			end;
		}
		npctalk strcharinfo(0) +" has guess correctly";
		getitem Apple, 1;
		.start = .guess = 0;
		end;
	}
}

 

Edited by AnnieRuru
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

I don't see a clean way to force to end a specific npc instance. The easiest way seems to add a check after every 'next' and co.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

use gettimetick(2)

prontera,150,185,0	script	test override	1_F_MARIA,{
	.@timelimit = 3 + gettimetick(2); // 3 seconds
	while (.@timelimit > gettimetick(2) ) {
		mes "You are talking to this npc";
		next;
		select("-Yes");
	}
	mes "times up";
	close;
}

if you are doing this like a quiz, where player has to reply within the time limit, then have to use if ... goto on every after select

 

btw, seems like I have lose a fan ... sad ....

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

 

2 hours ago, AnnieRuru said:

btw, seems like I have lose a fan ... sad ....

of course not, i am still one of them :wub:

2 hours ago, AnnieRuru said:

if you are doing this like a quiz, where player has to reply within the time limit, then have to use if ... goto on every after select

i was making some event treasure hunter, where the player need to break the lock by input serial code number on treasure there is 3 tries for every player, but i was stunted when there is still a player that in process breaking the code, but the treasure have been unlocked by another so the other shouldn't have access on the treasure anymore, btw I am using thanatos tower code guessing

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...