Jump to content
  • 0

How to count the number of open stores (@at) on the specific map


driver

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   3
  • Joined:  02/11/19
  • Last Seen:  

How are the rAthenians!?

I would like to know how I can add in the script the number of players with open stores (@at) on a given map.

For example:

prontera,155,165,5	script	Warper Market	99,{

	mes "[Market]";
	mes "Hello.";
	mes "Do you want to go to the Market?";
	switch(select("- Market [*Number of @at user on the map]:- Exit"))
	{
		case 1:
			warp "alberta",192,144;
			end;

		case 2:
			close;
	}
}

Please if anyone can help me I would be very grateful.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  255
  • Reputation:   232
  • Joined:  07/24/13
  • Last Seen:  

17 hours ago, driver said:

How are the rAthenians!?

I would like to know how I can add in the script the number of players with open stores (@at) on a given map.

For example:

Please if anyone can help me I would be very grateful.

For example like this

	// Get user list on map "prontera"
	.@num = getmapunits(BL_PC, "prontera", .@array$[0]);
	freeloop(1);
	for(.@i=0;.@i<getarraysize(.@array$);.@i++) {
		// If user in autotrade mode then increase counter
		if(checkvending(.@array$[.@i])&2)
			.@at_count++;
	}
	freeloop(0);
	mes  .@at_count + " @at users on the map.";
	close;

 

Edited by Balfear
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   3
  • Joined:  02/11/19
  • Last Seen:  

1 hour ago, Balfear said:

For example like this

	// Get user list on map "prontera"
	.@num = getmapunits(BL_PC, "prontera", .@array$[0]);
	freeloop(1);
	for(.@i=0;.@i<getarraysize(.@array$);.@i++) {
		// If user in autotrade mode then increase counter
		if(checkvending(.@array$[.@i]) == 2)
			.@at_count++;
	}
	freeloop(0);
	mes  .@at_count + " @at users on the map.";
	close;

 

Yes, the idea is very similar.
Show only the number of @at merchants on the specific map, in example '3' Merchants with automatic stores in Alberta.

merch.png

 

I tried using the script mentioned above, but it didn't work for me.
The counter shows '0', but there are 2 stores open on the map.

Can you help me please? if it's not too much trouble, sir.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  255
  • Reputation:   232
  • Joined:  07/24/13
  • Last Seen:  

@driver my mistake.
just change check from
if(checkvending(.@array$[.@i]) == 2)
to 
if(checkvending(.@array$[.@i])&2)

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   3
  • Joined:  02/11/19
  • Last Seen:  

8 hours ago, Balfear said:

@driver my mistake.
just change check from
if(checkvending(.@array$[.@i]) == 2)
to 
if(checkvending(.@array$[.@i])&2)

Thank you very much, Mr. Balfar. Worked perfectly.

@Balfear
One more question, how do I include ".@At_count +" in square brackets in the switch select? I tried it in a few ways, but to no avail.

 

prontera,155,165,5	script	Warper Market	99,{

	// Get user list on map "prontera"
	.@num = getmapunits(BL_PC, "prontera", .@array$[0]);
	freeloop(1);
	for(.@i=0;.@i<getarraysize(.@array$);.@i++) {
		// If user in autotrade mode then increase counter
		if(checkvending(.@array$[.@i])&2)
			.@at_count++;
	}
	freeloop(0);
	switch(select("- @AT Merchants ^2980B9[ .@at_count + ]^000000:- Exit")) {

	case 1:
		warp "prontera",150,150;
		end;
		
	case 2:
		close;
	}
}

Once again, thank you so much for your help.

Edited by driver
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  255
  • Reputation:   232
  • Joined:  07/24/13
  • Last Seen:  

3 hours ago, driver said:

Thank you very much, Mr. Balfar. Worked perfectly.

@Balfear
One more question, how do I include ".@At_count +" in square brackets in the switch select? I tried it in a few ways, but to no avail.

 

prontera,155,165,5	script	Warper Market	99,{

	// Get user list on map "prontera"
	.@num = getmapunits(BL_PC, "prontera", .@array$[0]);
	freeloop(1);
	for(.@i=0;.@i<getarraysize(.@array$);.@i++) {
		// If user in autotrade mode then increase counter
		if(checkvending(.@array$[.@i])&2)
			.@at_count++;
	}
	freeloop(0);
	switch(select("- @AT Merchants ^2980B9[ .@at_count + ]^000000:- Exit")) {

	case 1:
		warp "prontera",150,150;
		end;
		
	case 2:
		close;
	}
}

Once again, thank you so much for your help.

switch(select("- @AT Merchants ^2980B9["+ .@at_count + "]^000000:- Exit")) {
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   3
  • Joined:  02/11/19
  • Last Seen:  

Thank you sir. Issue resolved.

 

 

can lock the topic

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