Hi Adding Checkweight from script.

REKT

New member
Messages
372
Points
0
Emulator
Other
Hello, as title says:

can you check the fucntion checkw; if it is correct or wrong
default_sleep.png


http://pastebin.com/CVBZeu5i

Help would be greatly appreciated!

Thank you!

 
@@Vlync

You need to call your weight check before you start to delete the items even though it might be that the weight is low enough after the deletion of some items, if it isn't for some reason people would loose their items but get nothing.

Code:
prontera,142,169,5	script	Lira 	811,{	function checkw;	.npc$ = "^0099CCLira - Godlike Creator^000000";	mes .npc$;	mes "As l can see you, found your way to me ^0000ff"+strcharinfo(0)+"^000000.";	mes "although they require many rare ^FF0000jewels^000000 to make.";	mes " ";	mes "What can l mix for you?";	next;	switch( select( " - mix ^AA6A04Mjolnir^000000: - mix ^AA6A04Sleipnir^000000: - mix ^AA6A04Brisingamen^000000: - mix ^AA6A04Gleipnir^000000: - mix ^AA6A04Megingjard^000000" ) ) {		case 1:			mes .npc$;			mes "^3355FFMjolnir^000000 is the mighty Hammer of Thor.";			mes " ";			setarray .@Items[0],20030,1531,2,984,20,985,5,969,40,7074,2,7075,4,7078,5,7087,5,7089,5;		break;		case 2:			mes .npc$;			mes "^3355FFSleipnir^000000 are boots made after Odin's War Horse.";			mes " ";			setarray .@Items[0],20029,2406,2,984,1,969,20,985,10,7076,3,7079,5,7083,3,7086,3;		break;		case 3:			mes .npc$;			mes "^3355FFBrisingammen^000000 is the magical Necklace of Freyja, goddess of Beauty.";			mes " ";			setarray .@Items[0],2630,2603,1,726,2,722,3,727,10,723,5,969,20,7073,4,7077,4,7088,3,7090,3,7092,3;		break;		case 4:			mes .npc$;			mes "The ^3355FFGleipnir^000000 is a light yet strong rope required to make ^3355FFMegingjard^000000";			mes " ";			setarray .@Items[0],7058,7080,4,7081,5,7082,4,7084,3,7085,3;		break;		case 5:			mes .npc$;			mes "The ^3355FFMegingjard^000000 is the powerful Belt of Thor.";			setarray .@Items[0],20021,7058,1,2601,1,969,10,726,10,984,5;		break;	}	mes "^FF0000The ltems i need are as follows:^000000";	for(set .@i, 1; .@i <= getarraysize( .@Items[0] ); set .@i, .@i + 2 ) {		mes "^0000FF" + .@Items[.@i+1] + "^000000 x ^AA6A04" + getitemname( .@Items[ .@i ] ) + "^000000";		if ( countitem( .@Items[ .@i ] ) < .@Items[ .@i + 1 ] )			set .@nr, 1;	}	if (.@nr) close;	next;	mes .npc$;	mes "Do you want ^3355FF"+getitemname(.@Items[0])+"^000000?";	next;	if(select(" - Yes, Please: - No, Thanks")== 2) {		mes .npc$;		mes "Very well then, please go back, if you change your mind.";		close;	}	checkw .@Items[0];	mes .npc$;	mes "Here is your ^3355FF"+getitemname(.@Items[0])+"^000000.";	mes "lt may serve you well.";	for( set .@i, 1; .@i <= getarraysize( .@Items ); set .@i,.@i + 2 )		delitem .@Items[ .@i ], .@Items[ .@i + 1 ];	getitem .@Items[0],1;	close;	function        checkw  {		if( !checkweight( getarg(0), 1) ) {			mes .npc$;			mes "Your weight is too high!";			close;		}		return;	}}
 
@@Vlync

You need to call your weight check before you start to delete the items even though it might be that the weight is low enough after the deletion of some items, if it isn't for some reason people would loose their items but get nothing.

prontera,142,169,5 script Lira 811,{ function checkw; .npc$ = "^0099CCLira - Godlike Creator^000000"; mes .npc$; mes "As l can see you, found your way to me ^0000ff"+strcharinfo(0)+"^000000."; mes "although they require many rare ^FF0000jewels^000000 to make."; mes " "; mes "What can l mix for you?"; next; switch( select( " - mix ^AA6A04Mjolnir^000000: - mix ^AA6A04Sleipnir^000000: - mix ^AA6A04Brisingamen^000000: - mix ^AA6A04Gleipnir^000000: - mix ^AA6A04Megingjard^000000" ) ) { case 1: mes .npc$; mes "^3355FFMjolnir^000000 is the mighty Hammer of Thor."; mes " "; setarray .@Items[0],20030,1531,2,984,20,985,5,969,40,7074,2,7075,4,7078,5,7087,5,7089,5; break; case 2: mes .npc$; mes "^3355FFSleipnir^000000 are boots made after Odin's War Horse."; mes " "; setarray .@Items[0],20029,2406,2,984,1,969,20,985,10,7076,3,7079,5,7083,3,7086,3; break; case 3: mes .npc$; mes "^3355FFBrisingammen^000000 is the magical Necklace of Freyja, goddess of Beauty."; mes " "; setarray .@Items[0],2630,2603,1,726,2,722,3,727,10,723,5,969,20,7073,4,7077,4,7088,3,7090,3,7092,3; break; case 4: mes .npc$; mes "The ^3355FFGleipnir^000000 is a light yet strong rope required to make ^3355FFMegingjard^000000"; mes " "; setarray .@Items[0],7058,7080,4,7081,5,7082,4,7084,3,7085,3; break; case 5: mes .npc$; mes "The ^3355FFMegingjard^000000 is the powerful Belt of Thor."; setarray .@Items[0],20021,7058,1,2601,1,969,10,726,10,984,5; break; } mes "^FF0000The ltems i need are as follows:^000000"; for(set .@i, 1; .@i <= getarraysize( .@Items[0] ); set .@i, .@i + 2 ) { mes "^0000FF" + .@Items[.@i+1] + "^000000 x ^AA6A04" + getitemname( .@Items[ .@i ] ) + "^000000"; if ( countitem( .@Items[ .@i ] ) < .@Items[ .@i + 1 ] ) set .@nr, 1; } if (.@nr) close; next; mes .npc$; mes "Do you want ^3355FF"+getitemname(.@Items[0])+"^000000?"; next; if(select(" - Yes, Please: - No, Thanks")== 2) { mes .npc$; mes "Very well then, please go back, if you change your mind."; close; } checkw .@Items[0]; mes .npc$; mes "Here is your ^3355FF"+getitemname(.@Items[0])+"^000000."; mes "lt may serve you well."; for( set .@i, 1; .@i <= getarraysize( .@Items ); set .@i,.@i + 2 ) delitem .@Items[ .@i ], .@Items[ .@i + 1 ]; getitem .@Items[0],1; close; function checkw { if( !checkweight( getarg(0), 1) ) { mes .npc$; mes "Your weight is too high!"; close; } return; }}

Oh i see, damm i didn't notice that it's just a short typo. Thank you again @@Winterfox

@@Winterfox Addition, how can i add e.g Brisingamen Requirements items will be like this (Gold 0/10) it will green if it will complety gather.

also could you add   set .ShowID,1;            // Show item IDs? (1: yes / 0: no)

 
Last edited by a moderator:
@@Vlync

Code:
prontera,142,169,5	script	Lira 	811,{	function checkw;	mes .npc$;	mes "As l can see you, found your way to me ^0000ff"+strcharinfo(0)+"^000000.";	mes "although they require many rare ^FF0000jewels^000000 to make.";	mes " ";	mes "What can l mix for you?";	next;	switch( select( " - mix ^AA6A04Mjolnir^000000: - mix ^AA6A04Sleipnir^000000: - mix ^AA6A04Brisingamen^000000: - mix ^AA6A04Gleipnir^000000: - mix ^AA6A04Megingjard^000000" ) ) {		case 1:			mes .npc$;			mes ( (.ShowID ) ? "(20030) " : "" ) + "^3355FFMjolnir^000000 is the mighty Hammer of Thor.";			mes " ";			setarray .@Items[0],20030,1531,2,984,20,985,5,969,40,7074,2,7075,4,7078,5,7087,5,7089,5;		break;		case 2:			mes .npc$;			mes ( (.ShowID ) ? "(20029) " : "" ) + "^3355FFSleipnir^000000 are boots made after Odin's War Horse.";			mes " ";			setarray .@Items[0],20029,2406,2,984,1,969,20,985,10,7076,3,7079,5,7083,3,7086,3;		break;		case 3:			mes .npc$;			mes ( (.ShowID ) ? "(2630) " : "" ) + "^3355FFBrisingammen^000000 is the magical Necklace of Freyja, goddess of Beauty.";			mes " ";			setarray .@Items[0],2630,2603,1,726,2,722,3,727,10,723,5,969,20,7073,4,7077,4,7088,3,7090,3,7092,3;		break;		case 4:			mes .npc$;			mes ( (.ShowID ) ? "(7058) " : "" ) + "The ^3355FFGleipnir^000000 is a light yet strong rope required to make ^3355FFMegingjard^000000";			mes " ";			setarray .@Items[0],7058,7080,4,7081,5,7082,4,7084,3,7085,3;		break;		case 5:			mes .npc$;			mes ( (.ShowID ) ? "(20021) " : "" ) + "The ^3355FFMegingjard^000000 is the powerful Belt of Thor.";			setarray .@Items[0],20021,7058,1,2601,1,969,10,726,10,984,5;		break;	}		set .@nr, 0;	mes "^FF0000The ltems i need are as follows:^000000";	for(set .@i, 1; .@i <= getarraysize( .@Items ); set .@i, .@i + 2 ) {		set .@color$, "72E300"; 		set .@itemCount, countitem( .@Items[ .@i ] );		if ( .@itemCount < .@Items[ .@i + 1 ] ) {			set .@nr, 1;			set .@color$, "FF0000"; 		}				mes "^" + .@color$ + .@Items[.@i + 1] + " x " +  ( (.ShowID ) ? "(" + .@Items[ .@i ] + ") " : "" ) + getitemname( .@Items[ .@i ] ) + " " + .@itemCount + "/" + .@Items[ .@i + 1 ] + "^000000";	}	if (.@nr) close;	next;	mes .npc$;	mes "Do you want " + ( ( .ShowID ) ? "(" + .@Items[ 0 ] + ") " : "" ) + "^3355FF" + getitemname( .@Items[ 0 ] ) +" ^000000?";	next;	if(select(" - Yes, Please: - No, Thanks")== 2) {		mes .npc$;		mes "Very well then, please go back, if you change your mind.";		close;	}	checkw .@Items[0];	mes .npc$;	mes "Here is your " + ( ( .ShowID ) ? "(" + .@Items[ 0 ] + ") " : "" ) + "^3355FF"+getitemname(.@Items[0])+"^000000.";	mes "lt may serve you well.";	for( set .@i, 1; .@i <= getarraysize( .@Items ); set .@i,.@i + 2 )		delitem .@Items[ .@i ], .@Items[ .@i + 1 ];	getitem .@Items[0],1;	close;		end;		OnInit:				set .npc$, "^0099CCLira - Godlike Creator^000000";		set .ShowID,1; 	end;		function        checkw  {		if( !checkweight( getarg(0), 1) ) {			mes .npc$;			mes "Your weight is too high!";			close;		}		return;	}}
 
Last edited by a moderator:
@@Vlync

prontera,142,169,5 script Lira 811,{ function checkw; .npc$ = "^0099CCLira - Godlike Creator^000000"; mes .npc$; mes "As l can see you, found your way to me ^0000ff"+strcharinfo(0)+"^000000."; mes "although they require many rare ^FF0000jewels^000000 to make."; mes " "; mes "What can l mix for you?"; next; switch( select( " - mix ^AA6A04Mjolnir^000000: - mix ^AA6A04Sleipnir^000000: - mix ^AA6A04Brisingamen^000000: - mix ^AA6A04Gleipnir^000000: - mix ^AA6A04Megingjard^000000" ) ) { case 1: mes .npc$; mes ( (.ShowID ) ? "(20030) " : "" ) + "^3355FFMjolnir^000000 is the mighty Hammer of Thor."; mes " "; setarray .@Items[0],20030,1531,2,984,20,985,5,969,40,7074,2,7075,4,7078,5,7087,5,7089,5; break; case 2: mes .npc$; mes ( (.ShowID ) ? "(20029) " : "" ) + "^3355FFSleipnir^000000 are boots made after Odin's War Horse."; mes " "; setarray .@Items[0],20029,2406,2,984,1,969,20,985,10,7076,3,7079,5,7083,3,7086,3; break; case 3: mes .npc$; mes ( (.ShowID ) ? "(2630) " : "" ) + "^3355FFBrisingammen^000000 is the magical Necklace of Freyja, goddess of Beauty."; mes " "; setarray .@Items[0],2630,2603,1,726,2,722,3,727,10,723,5,969,20,7073,4,7077,4,7088,3,7090,3,7092,3; break; case 4: mes .npc$; mes ( (.ShowID ) ? "(7058) " : "" ) + "The ^3355FFGleipnir^000000 is a light yet strong rope required to make ^3355FFMegingjard^000000"; mes " "; setarray .@Items[0],7058,7080,4,7081,5,7082,4,7084,3,7085,3; break; case 5: mes .npc$; mes ( (.ShowID ) ? "(20021) " : "" ) + "The ^3355FFMegingjard^000000 is the powerful Belt of Thor."; setarray .@Items[0],20021,7058,1,2601,1,969,10,726,10,984,5; break; } mes "^FF0000The ltems i need are as follows:^000000"; for(set .@i, 1; .@i <= getarraysize( .@Items[0] ); set .@i, .@i + 2 ) { set .@color$, "72E300"; set .@itemCount, countitem( .@Items[ .@i ] ); if ( .@itemCount < .@Items[ .@i + 1 ] ) { set .@nr, 1; set .@color$, "FF0000"; } mes "^" + .@color$ + .@Items[.@i + 1] + " x " + ( (.ShowID ) ? "(" + .@Items[ .@i ] + ") " : "" ) + getitemname( .@Items[ .@i ] ) + " " + .@itemCount + "/" + .@Items[ .@i + 1 ] + "^000000"; } if (.@nr) close; next; mes .npc$; mes "Do you want " + ( ( .ShowID ) ? "(" + .@Items[ 0 ] + ") " : "" ) + "^3355FF" + getitemname( .@Items[ 0 ] ) +" ^000000?"; next; if(select(" - Yes, Please: - No, Thanks")== 2) { mes .npc$; mes "Very well then, please go back, if you change your mind."; close; } checkw .@Items[0]; mes .npc$; mes "Here is your " + ( ( .ShowID ) ? "(" + .@Items[ 0 ] + ") " : "" ) + "^3355FF"+getitemname(.@Items[0])+"^000000."; mes "lt may serve you well."; for( set .@i, 1; .@i <= getarraysize( .@Items ); set .@i,.@i + 2 ) delitem .@Items[ .@i ], .@Items[ .@i + 1 ]; getitem .@Items[0],1; close; end; OnInit: set .ShowID,1; end; function checkw { if( !checkweight( getarg(0), 1) ) { mes .npc$; mes "Your weight is too high!"; close; } return; }}

mes "^FF0000The ltems i need are as follows:^000000";

for(set .@i, 1; .@i <= getarraysize( .@Items[0] ); set .@i, .@i + 2 ) {

set .@color$, "72E300";

set .@itemCount, countitem( .@Items[ .@i ] );

if ( .@itemCount < .@Items[ .@i + 1 ] ) {

set .@nr, 1;

set .@color$, "FF0000";

}

mes "^" + .@color$ + .@Items[.@i + 1] + " x " + ( (.ShowID ) ? "(" + .@Items[ .@i ] + ") " : "" ) + getitemname( .@Items[ .@i ] ) + " " + .@itemCount + "/" + .@Items[ .@i + 1 ] + "^000000";

}

if (.@nr) close;

next;

mes .npc$;

mes "Do you want " + ( ( .ShowID ) ? "(" + .@Items[ 0 ] + ") " : "" ) + "^3355FF" + getitemname( .@Items[ 0 ] ) +" ^000000?";

next;

if(select(" - Yes, Please: - No, Thanks")== 2) {

mes .npc$;

mes "Very well then, please go back, if you change your mind.";

close;

}

checkw .@Items[0];

mes .npc$;

mes "Here is your " + ( ( .ShowID ) ? "(" + .@Items[ 0 ] + ") " : "" ) + "^3355FF"+getitemname(.@Items[0])+"^000000.";

mes "lt may serve you well.";

for( set .@i, 1; .@i <= getarraysize( .@Items ); set .@i,.@i + 2 )

delitem .@Items[ .@i ], .@Items[ .@i + 1 ];

getitem .@Items[0],1;

close;
Kindly please check that line please? when i complete the requirments, the conversation is just 'close'

http://i.imgur.com/2QdoU2P.png

Thank you!

 
Back
Top