Jump to content
  • 0

Conditions for Labels and inside menus


Erebos

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

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
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

I think you forgot to put an IF on it.

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  431
  • Reputation:   164
  • Joined:  12/12/17
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

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;

}

 

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:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  431
  • Reputation:   164
  • Joined:  12/12/17
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  431
  • Reputation:   164
  • Joined:  12/12/17
  • Last Seen:  

13 hours ago, Brizyous said:

pajodex is more noob friendly xD.

I barely explained anything... Glad to help

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