• 0
Sign in to follow this  
Brizyous

Conditions for Labels and inside menus

Question

Two questions about conditions:


Conditions for labels: Its possible to add a condition to pass to a Label? like, a condition of groupid 1 for OnPCDieEvent to trigger in the player. (I know i can do it inside the label, but i cant make it work otherwise).


Condition inside a menu: IDK how o do it, tried this(i apologize if its stupid xD, i am very new in scripting) :

switch(select("+((countitem(34996) >= 1)"wow you have item 34996")+":"some text")) { }

its supposed to print case 1 only if the player has the item, otherwise it should only print case 2.

Edited by Brizyous

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

for the labels , the rathena official labels controled by the src , you can not call it , it would be called automatically , however you can make your own label (see goto or callsub command scripts)

for the Condition i think you are missing something >> see this example and figure it out

mes ((1 != 0)?"true":"false");

 

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
5 hours ago, Brizyous said:

Two questions about conditions:


Conditions for labels: Its possible to add a condition to pass to a Label? like, a condition of groupid 1 for OnPCDieEvent to trigger in the player. (I know i can do it inside the label, but i cant make it work otherwise).


Condition inside a menu: IDK how o do it, tried this(i apologize if its stupid xD, i am very new in scripting) :

switch(select("+((countitem(34996) >= 1)"wow you have item 34996")+":"some text")) { }

its supposed to print case 1 only if the player has the item, otherwise it should only print case 2.

switch(select( (countitem(34996) >= 1)? "wow you have item 34996":"some text")) { }
  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
6 hours ago, pajodex said:
switch(select( (countitem(34996) >= 1)? "wow you have item 34996":"some text")) { }

Thanks! it worked but the arguments replace each other generating a 1 option menu, what i want is if the players have 4 items, they get a 4 option menu, if they have 2 items, they get 2 options, corresponding to the item they have.
Tried this, but i get errors:
 

switch(select((countitem(34996) >= 1)?"Insertar Ticket Clase C" , (countitem(34995) >= 1)?"Insertar Ticket Clase B" , (countitem(34994) >= 1)?"Insertar Ticket Clase A" , (countitem(34993) >= 1)?"Insertar Ticket Clase S" , "Cancelar")) {

	case 1:
	mes "ticket 1";
	close;
	end;
	case 2:
	mes "ticket 2";
	close;
	end;
	case 3:
	mes "ticket 3";
	close;
	end;
	case 4:
	mes "ticket 4";
	close;
	end;
	case 5:
	close;
	end;

}

 

Share this post


Link to post
Share on other sites
  • 0

I already lost count how many times I have been using getinventorylist this month ...

function	script	F_MesItemInfo	{
	.@item = getarg(0);
	.@itemname$ = getitemname(.@item);
	if (.@itemname$ == "null")
		.@itemname$ = "Unknown Item";
	if (PACKETVER >= 20150729)
		return sprintf("<ITEM>%s<INFO>%d</INFO></ITEM>", .@itemname$, .@item);
	else if (PACKETVER >= 20130130)
		return sprintf("<ITEMLINK>%s<INFO>%d</INFO></ITEMLINK>", .@itemname$, .@item);
	else
		return .@itemname$;
}

prontera,155,185,5	script	jdshfjsdfh	1_F_MARIA,{
	getinventorylist;
	for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
		if ( inarray(.itemlist, @inventorylist_id[.@i] ) >= 0 ) {
			.@itemid[.@c++] = @inventorylist_id[.@i];
			.@menu$ += getitemname( @inventorylist_id[.@i] ) +":";
		}
	}
	if ( !.@c ) {
		mes "You don't have any ticket on you";
		close;
	}
	.@s = select( .@menu$ ) -1;
	mes "You have selected "+ F_MesItemInfo(.@itemid[.@s]);
	close;
OnInit:
	setarray .itemlist, 909,910,911,912,
		34993,34994,34995,34996;
	end;
}

 

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, AnnieRuru said:

I already lost count how many times I have been using getinventorylist this month ...

function	script	F_MesItemInfo	{
	.@item = getarg(0);
	.@itemname$ = getitemname(.@item);
	if (.@itemname$ == "null")
		.@itemname$ = "Unknown Item";
	if (PACKETVER >= 20150729)
		return sprintf("<ITEM>%s<INFO>%d</INFO></ITEM>", .@itemname$, .@item);
	else if (PACKETVER >= 20130130)
		return sprintf("<ITEMLINK>%s<INFO>%d</INFO></ITEMLINK>", .@itemname$, .@item);
	else
		return .@itemname$;
}

prontera,155,185,5	script	jdshfjsdfh	1_F_MARIA,{
	getinventorylist;
	for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
		if ( inarray(.itemlist, @inventorylist_id[.@i] ) >= 0 ) {
			.@itemid[.@c++] = @inventorylist_id[.@i];
			.@menu$ += getitemname( @inventorylist_id[.@i] ) +":";
		}
	}
	if ( !.@c ) {
		mes "You don't have any ticket on you";
		close;
	}
	.@s = select( .@menu$ ) -1;
	mes "You have selected "+ F_MesItemInfo(.@itemid[.@s]);
	close;
OnInit:
	setarray .itemlist, 909,910,911,912,
		34993,34994,34995,34996;
	end;
}

 

Thanks for this magic, but how to have differents effect depending on the selected item? if i simply add countitem if they have 2 items the condition will pass.

Edited by Brizyous

Share this post


Link to post
Share on other sites
  • 0
5 hours ago, Brizyous said:

Thanks! it worked but the arguments replace each other generating a 1 option menu, what i want is if the players have 4 items, they get a 4 option menu, if they have 2 items, they get 2 options, corresponding to the item they have.
Tried this, but i get errors:
 

switch(select((countitem(34996) >= 1)?"Insertar Ticket Clase C" , (countitem(34995) >= 1)?"Insertar Ticket Clase B" , (countitem(34994) >= 1)?"Insertar Ticket Clase A" , (countitem(34993) >= 1)?"Insertar Ticket Clase S" , "Cancelar")) {

	case 1:
	mes "ticket 1";
	close;
	end;
	case 2:
	mes "ticket 2";
	close;
	end;
	case 3:
	mes "ticket 3";
	close;
	end;
	case 4:
	mes "ticket 4";
	close;
	end;
	case 5:
	close;
	end;

}

 

switch(select((countitem(34996))?"Insertar Ticket Clase C":"" , (countitem(34995)) ? "Insertar Ticket Clase B":"", (countitem(34994)) ? "Insertar Ticket Clase A":"", (countitem(34993)) ? "Insertar Ticket Clase S":"", "Cancelar"))

 

  • Upvote 1
  • Love 1

Share this post


Link to post
Share on other sites
  • 0

Thanks everyone,  although i would love to understand Annie's script(i'll analyze it later), pajodex is more noob friendly xD.

Share this post


Link to post
Share on other sites
  • 0
13 hours ago, Brizyous said:

pajodex is more noob friendly xD.

I barely explained anything... Glad to help

Share this post


Link to post
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.

Loading...
Sign in to follow this