Jump to content
  • 0

R>@resists


Santafe

Question


  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

Hello everyone!

I would like to request a script that could give players the details of resistance through cards/ items equipped by the player, Example: if im wearing ring of flame lord, I type @resist and it shows Fire resistance : 20% and if i have included something like Jakk / Leib Olmai into my equipment, It shows : Fire resistance : 50% or watever. Just a general idea being similar to one server i played a long time ago ( I think 2008 to be exact), was a spanish one so i dont remember the name. Basically once i type @resist, a window popsup saying:

Fire Resistance: 0%

Water Resistance: 0%

Earth Resistance: 0%

Wind Resistance: 0%

Ghost Resistance: 0%

Poison Resistance: 0%

Shadow Resistance: 0%

PLEASE NOTE:

Im not asking for a high end script , all i ask for is an initial script with Bindatcmd for maybe 1 resistance( Example: I type @resists and fire resistance is shown, the script checks itemdb for Jakk/Leib/ROFL ring/Draco card)? and if the script compares the itemdb of the card compounded as mentioned in the brackets, Ill duplicate it for other resists accordingly.

Thanks and Regards,

Santa

Link to comment
Share on other sites

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Ok peoples, here you are. I used item_info_re table in database, but you can change it to item_info according to your own setup.

Also, I just list scripts on items + cards coumpound. If you need the set to be added, you'll have to add it ^^

resistantInfos.txt

ResistList.thumb.jpg.0474a69a8ac2ce43e07a23d34ee9c285.jpg

  • Love 1
Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Something like this

resistantInfos.txt

Or you can perhaps change it to increase all values, but it'll get more tricky ^^

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Well as far as I can think of it, it's a REALLY big work, cause you can't get the script of an item from it's id (except if there's an info or a command I don't know), except if you're running your server on sql mode. 

So if we're considering this as true, you'll have to list all resistance somewhere, in arrays or something, to retrieve it when you'll run the command (forget it, that's too much work)

On the other hand, if you're on sql mode (or at least if you have the item_db sql table uptodate), you can run an sql command to retrieve the script column of given id and parse it's content to determine the resistance.

Are you fullfilling this pre-requisite?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

22 minutes ago, Alayne said:

Well as far as I can think of it, it's a REALLY big work, cause you can't get the script of an item from it's id (except if there's an info or a command I don't know), except if you're running your server on sql mode. 

So if we're considering this as true, you'll have to list all resistance somewhere, in arrays or something, to retrieve it when you'll run the command (forget it, that's too much work)

On the other hand, if you're on sql mode (or at least if you have the item_db sql table uptodate), you can run an sql command to retrieve the script column of given id and parse it's content to determine the resistance.

Are you fullfilling this pre-requisite?

Hey Alayne, Honestly i dont mind making it an sql mode and since im still in test phase of my server im still flexible and yea I can add the item_db sql table, although Im using the rAmod 2013 item database and in pre-renewal mode, the cards are all pretty much older than that.

Edited by Santafe
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Allright, I'll try to make a general skeleton during the day then ^^

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

1 minute ago, Alayne said:

Allright, I'll try to make a general skeleton during the day then ^^

Thanks alot <3 Really appreciate it!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Here you are. Can't test it right now, but this should more or less be what you're expecting.

Finally I've made it entirely, as it was easier for me to handle it through array.

resistantInfos.txt

If somebody have better ideas than that, you're to go ^^

You just have to fill pos array, I'm currently only checking Armor and a wrong value of Head. Fill with EQI_ARMOR, EQI_WEAPON...and so on.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

35 minutes ago, Alayne said:

Here you are. Can't test it right now, but this should more or less be what you're expecting.

Finally I've made it entirely, as it was easier for me to handle it through array.

resistantInfos.txt

If somebody have better ideas than that, you're to go ^^

You just have to fill pos array, I'm currently only checking Armor and a wrong value of Head. Fill with EQI_ARMOR, EQI_WEAPON...and so on.

Does not work?
 

-	script	Resist Manager::alarm	-1,{
    end;
	
OnAtcommand:	
	setarray .@resistsValues[0], 0, 0, 0, 0, 0, 0, 0, 0, 0;
	setarray .@resistsType$[0], "Fire", "Water", "Wind", "Earth", "Holy", "Dark", "Ghost", "Poison", "Neutral";
	
	//ARMOR
	setarray .@equipPos[0], EQI_ARMOR, EQI_HEAD;
	freeloop 1;
	for( .@r = 0; .@r < getarraysize(.@resistsValues); .@r++ ) {
		for( .@p = 0; .@p < getarraysize(.@equipPos); .@p++ ) {
			.@id = getequipid(.@pos);
			
			//get equip resists
			.@resistsValues[.@r] += callsub("OnGetResist", .@r, .@id);
			
			//now, check cards coumpounded
			for( .@i = 0; .@i < 4; .@i++ ) {
				.@id = getequipcardid(.@pos, .@i);
				if(.@id > 0) {
					.@resistsValues[.@r] += callsub("OnGetResist", .@r, .@id);
				}
			}
		}
	}
	freeloop 0;
	dispbottom "-------------------Resist Values-------------------";
	for( .@r = 0; .@r < getarraysize(.@resistsValues); .@r++ ) {
		dispbottom "	~" + .@resistsType$[.@r] + " --> " + .@resistsValues[.@r];
	}
	end;
	
OnGetResist:
	query_sql("SELECT `script` FROM `item_db` WHERE `id` = " + getarg(1), .@result$);
	if(getarraysize(.@result$) > 0) {
		.@script$ = .@result$[0];
		.@seekStr$ = "bonus2 bSubEle,Ele_";
		switch(getarg(0)) {
			case 0:
				.@seekStr$ += "Fire",
				break;
			case 1:
				.@seekStr$ += "Water",
				break;
			case 2:
				.@seekStr$ += "Wind",
				break;
			case 3:
				.@seekStr$ += "Earth",
				break;
			case 4:
				.@seekStr$ += "Holy",
				break;
			case 5:
				.@seekStr$ += "Dark",
				break;
			case 6:
				.@seekStr$ += "Ghost",
				break;
			case 7:
				.@seekStr$ += "Poison",
				break;
			case 8:
				.@seekStr$ += "Neutral",
				break;
		}
		if(compare(.@script$, .@seekStr$) == 1) {
			explode(.@dest$, .@script$, .@seekStr$);
			if(getarraysize(.@seekStr$) > 1)
			{
				.@valueAfter$ = .@seekStr$[1];
				explode(.@values$, .@valueAfter$, ";");
				if(getarraysize(.@values$) > 1) {
					.@realValue = atoi(.@values$[0]);
				}
			}
		}
	}
	return .@realValue;
	
OnInit:
	bindatcmd "resistlist",strnpcinfo(3) + "::OnAtcommand";
	end;
}


 

Capture.PNG

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   7
  • Joined:  12/30/11
  • Last Seen:  

14 minutes ago, Elysium said:

Does not work?
 


-	script	Resist Manager::alarm	-1,{
    end;
	
OnAtcommand:	
	setarray .@resistsValues[0], 0, 0, 0, 0, 0, 0, 0, 0, 0;
	setarray .@resistsType$[0], "Fire", "Water", "Wind", "Earth", "Holy", "Dark", "Ghost", "Poison", "Neutral";
	
	//ARMOR
	setarray .@equipPos[0], EQI_ARMOR, EQI_HEAD;
	freeloop 1;
	for( .@r = 0; .@r < getarraysize(.@resistsValues); .@r++ ) {
		for( .@p = 0; .@p < getarraysize(.@equipPos); .@p++ ) {
			.@id = getequipid(.@pos);
			
			//get equip resists
			.@resistsValues[.@r] += callsub("OnGetResist", .@r, .@id);
			
			//now, check cards coumpounded
			for( .@i = 0; .@i < 4; .@i++ ) {
				.@id = getequipcardid(.@pos, .@i);
				if(.@id > 0) {
					.@resistsValues[.@r] += callsub("OnGetResist", .@r, .@id);
				}
			}
		}
	}
	freeloop 0;
	dispbottom "-------------------Resist Values-------------------";
	for( .@r = 0; .@r < getarraysize(.@resistsValues); .@r++ ) {
		dispbottom "	~" + .@resistsType$[.@r] + " --> " + .@resistsValues[.@r];
	}
	end;
	
OnGetResist:
	query_sql("SELECT `script` FROM `item_db` WHERE `id` = " + getarg(1), .@result$);
	if(getarraysize(.@result$) > 0) {
		.@script$ = .@result$[0];
		.@seekStr$ = "bonus2 bSubEle,Ele_";
		switch(getarg(0)) {
			case 0:
				.@seekStr$ += "Fire",
				break;
			case 1:
				.@seekStr$ += "Water",
				break;
			case 2:
				.@seekStr$ += "Wind",
				break;
			case 3:
				.@seekStr$ += "Earth",
				break;
			case 4:
				.@seekStr$ += "Holy",
				break;
			case 5:
				.@seekStr$ += "Dark",
				break;
			case 6:
				.@seekStr$ += "Ghost",
				break;
			case 7:
				.@seekStr$ += "Poison",
				break;
			case 8:
				.@seekStr$ += "Neutral",
				break;
		}
		if(compare(.@script$, .@seekStr$) == 1) {
			explode(.@dest$, .@script$, .@seekStr$);
			if(getarraysize(.@seekStr$) > 1)
			{
				.@valueAfter$ = .@seekStr$[1];
				explode(.@values$, .@valueAfter$, ";");
				if(getarraysize(.@values$) > 1) {
					.@realValue = atoi(.@values$[0]);
				}
			}
		}
	}
	return .@realValue;
	
OnInit:
	bindatcmd "resistlist",strnpcinfo(3) + "::OnAtcommand";
	end;
}

 

Capture.PNG

Try https://pastebin.com/R6rVrfS0

Edited by AdrianoGC
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

4 minutes ago, AdrianoGC said:

Thanks buddy, however same thing. i think i'm using an older rev of emulator that's why. :(

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

Good suggestion @Santafe .

I'd like to have these kind of atcommands for all status changes in future, for debugging purposes. But that'd need some code refactorizations i think :/

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

As I said I can't debug it, so it's just the skeleton. But that's the main idea (and it require item_db to be uptodate on sql table)

Edited by Alayne
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

32 minutes ago, Alayne said:

As I said I can't debug it, so it's just the skeleton. But that's the main idea (and it require item_db to be uptodate on sql table)

Hey Alayne! I tried to run the script after using the sql table for item_db, i think the problem is with the EQI_ARMOR and EQI_HEAD part? cuz i tested steel chonchon card on cotton shirt but nothing showed, theres no error in console either, it just shows the line " -----resist values----" 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Quote

You just have to fill pos array, I'm currently only checking Armor and a wrong value of Head. Fill with EQI_ARMOR, EQI_WEAPON...and so on.

As said. And as said, can't debug it now, so either you'll have to debug it (logic isn't really hard to figure), otherwise wait for me to debug it ^^

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

47 minutes ago, Jey said:

Good suggestion @Santafe .

I'd like to have these kind of atcommands for all status changes in future, for debugging purposes. But that'd need some code refactorizations i think :/

I think more efficient is doing source modification I think?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

5 minutes ago, Alayne said:

As said. And as said, can't debug it now, so either you'll have to debug it (logic isn't really hard to figure), otherwise wait for me to debug it ^^

Alright xD I tried to see the logic, ill wait for the debug cuz i tried to edit a few things but something is the issue with displaybottom message? after the ----Resist values--- Just a suggestion on where to look xD

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Honestly, don't know. I don't understand how that's possible, cause it should at least have written something like

-----Resist-----

~Fire -> 0%

~Water -> 0%

~Wind -> 0%

...

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

So I'll have to debug it. I'll look at it tonight (4pm here, I'll get home around 6)

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

7 hours ago, Alayne said:

Ok peoples, here you are. I used item_info_re table in database, but you can change it to item_info according to your own setup.

Also, I just list scripts on items + cards coumpound. If you need the set to be added, you'll have to add it ^^

resistantInfos.txt

ResistList.thumb.jpg.0474a69a8ac2ce43e07a23d34ee9c285.jpg

Hey Alayne! I tried running it, I guess its something to do with my rA version? cuz all i see is this:

 

Test1.jpg

I even changed item_db_re to item_db, so since im using a 2013 client supporting server, and since i suck at scripting I do have to ask this stupid question, did rA implement support for smthing like freeloop after 2013 servers? O_o cuz it seems to me that the loop area is the one causing this to not show up.

Edit:

Just found this on my server side lol:

 

Untitled.png

Edited by Santafe
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Hum...That's strange. You've changed the script right? It's hard to say cause we don't use the same version so, it's difficult to locate the issue...Can you add some debugmes at logic places in the script to see which command cause the issue? I don't think that's the freeloop, cause it says it blocks on a variable attribution (set error), but can't say which one this way :/

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.08
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

what is the command of this script?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.08
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

im just wondering if resislist only but i dont see any values

 

image.png.07fae639b1a99392189c3e3f29a24ca9.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

As said earlier, you need to have an uptodate item_info_re on database if you're using the script as I gave it.

Edited by Alayne
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.08
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

12 minutes ago, Alayne said:

As said earlier, you need to have an uptodate item_info_re on database if you're using the script as I gave it.

hmmm as far i can see i check my table but i use item_db_re also XD

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

And you have some resits stuff equiped?

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