SphereCommunity
ASCPAD issue - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: ASCPAD issue (/Thread-ASCPAD-issue)



ASCPAD issue - Crusader - 03-03-2013 03:10 AM

doing this:

Code:
[FUNCTION f_bla]
serv.log <ASCPAD 15, <SRC.NAME>>

i have:
18:05:ERROR:(erehwon_player_events.scp,37)Can't resolve <ASCPAD15>
18:05:(erehwon_player_events.scp,37)043 072 075 073 061 064 065 072 00 00 00 00 00 00 00
18:05:1:'Crusader' commands 'f_bla'=1

So, the function works fine, but i have this shitty error...and dunno why. Does it happens to u too? I'm using today's built (2 march)


RE: ASCPAD issue - Ben - 03-03-2013 06:50 AM

No idea why I never fot the error before... but I found the problem and will be fixed asap.


RE: ASCPAD issue - Crusader - 03-03-2013 07:03 AM

thx a lot, happy to contribute ^^


RE: ASCPAD issue - admin phoenix - 03-03-2013 10:30 PM

can you explain the command what it does via an example then?
didnĀ“t understand it from the revision text Smile


RE: ASCPAD issue - Crusader - 03-03-2013 10:45 PM

well..this is a very useful command for who works with sendpackets.... i will do an example here:
Let's take this packet:

Quote:Packet Name: Status Bar Info
Last Modified: 2009-08-13 10:43:24
Modified By: MuadDib

Packet: 0x11
Sent By: Server
Size: Variable

Packet Build
BYTE[1] 0x11
BYTE[2] Length
BYTE[4] Player Serial
BYTE[30] Player Name
BYTE[2] Current Hit Points (see notes)
BYTE[2] Max Hit Points (see notes)
BYTE[1] Name Change Flag (see notes)
BYTE[1] Status Flag (see notes)
BYTE[1] Sex+Race (see notes)
BYTE[2] Strength
BYTE[2] Dexterity
BYTE[2] Intelligence
BYTE[2] Current Stamina
BYTE[2] Max Stamina
BYTE[2] Current Mana
BYTE[2] Max Mana
BYTE[4] Gold In Pack
BYTE[2] Armor Rating (see notes)
BYTE[2] Weight
If (flag 5 or higher)
BYTE[2] Max Weight
BYTE[1] Race (see notes)
If (flag 3 or higher )
BYTE[2] Stats Cap
BYTE[1] Followers (Pets)
BYTE[1] Followers Max Possible (Pets)
If (flag 4 or higher)
BYTE[2] Fire Resist (see notes)
BYTE[2] Cold Resist (see notes)
BYTE[2] Poison Resist (see notes)
BYTE[2] Energy Resist (see notes)
BYTE[2] Luck
BYTE[2] Damage Minimum
BYTE[2] Damage Maximum
BYTE[4] Tithing points (Paladin Books)
If (flag 6 or higher)
BYTE[2] Hit Chance Increase
BYTE[2] Swing Speed Increase
BYTE[2] Damage Chance Increase
BYTE[2] Lower Reagent Cost
BYTE[2] Hit Points Regeneration
BYTE[2] Stamina Regeneration
BYTE[2] Mana Regeneration
BYTE[2] Reflect Physical Damage
BYTE[2] Enhance Potions
BYTE[2] Defense Chance Increase
BYTE[2] Spell Damage Increase
BYTE[2] Faster Cast Recovery
BYTE[2] Faster Casting
BYTE[2] Lower Mana Cost
BYTE[2] Strength Increase
BYTE[2] Dexterity Increase
BYTE[2] Intelligence Increase
BYTE[2] Hit Points Increase
BYTE[2] Stamina Increase
BYTE[2] Mana Increase
BYTE[2] Maximum Hit Points Increase
BYTE[2] Maximum Stamina Increase
BYTE[2] Maximum Mana Increase

Subcommand Build
N/A

Notes
For characters other than the player, Current Hitpoints and Max Hitpoints are not the actual values. Max Hitpoints is a fixed value, and Current Hitpoints works like a percentage. This is to assist in blocking injection style tools from seeing real hitpoint values.

Name Change Flag
1: Allowed to Change In StatusBar (like with pets)
0: Not allowed

Status Flag
0x00: no more data following (end of packet here).
0x01: T2A Extended Info
0x03: UOR Extended Info
0x04: AOS Extended Info (4.0+)
0x05: UOML Extended Info (5.0+)
0x06: UOKR Extended Info (UOKR+)

Sex + Race
0: Male Human
1: Female Human
2: Male Elf
3: Female Elf

Armor Rating
Armor Rating depends on client settings. If client has AOS Resistances enabled, this should be the Physical Resist instead of older AR Rating.

UOML+ Race Flag
1: Human
2: Elf
3: Gargoyle

Resistances
Resistances can be negatives. Easiest method for handling this correctly is, if a negative is to be sent is: 0x10000+amount


So, my sendpacket function is:
Code:
ON=@UserStats
IF (<SRC.ISPLAYER>) || (<SRC.ISGM>)
SRC.sendpacket 011 W057 D<uid> <ASCPAD 30, <NAME>> W<hits> W<maxhits> 00 05 <findstatusracesex> W<STR> W<DEX> W<INT> W<STAM> W<MAXSTAM> W<MANA> W<MAXMANA> D<GOLD> W<AC> W<eval <WEIGHT>/10> W<eval <MAXWEIGHT>/10> <findstatusrace> W<skillclass.statsum> 00 00 W<RESFIRE> W<RESCOLD> W<RESPOISON> W<RESENERGY> W<LUCK> W<RITORNA 1,<FINDDAMAGE>> W<RITORNA 2,<FINDDAMAGE>> //00 00 00 00
RETURN 1
ENDIF
RETURN 0

Now, if i wouldn't use the ascpad function, this would be like:
Code:
SRC.sendpacket 011 W057 D<uid> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 W<hits> W<maxhits> 00 05 <findstatusracesex> W<STR> W<DEX> W<INT> W<STAM> W<MAXSTAM> W<MANA> W<MAXMANA> D<GOLD> W<AC> W<eval <WEIGHT>/10> W<eval <MAXWEIGHT>/10> <findstatusrace> W<skillclass.statsum> 00 00 W<RESFIRE> W<RESCOLD> W<RESPOISON> W<RESENERGY> W<LUCK> W<RITORNA 1,<FINDDAMAGE>> W<RITORNA 2,<FINDDAMAGE>> //00 00 00 00

And ofc in the status bar will appear no name....coz everything is zero. So i would need to build a function that transform text in hex value for every letter, and control the lenght of every char and tap the remaning with 00. Every byte (00) represent the hex of the letter of the char's name, for a total lenght of 30 bytes.
Doing <ascpad 30, <name>> i will fill the bytes with the hex value of my name, plus, for the remaining bytes the function will put 00 00 00etc.
VERY useful!

hope u get it ^^'


RE: ASCPAD issue - admin phoenix - 03-04-2013 06:14 PM

thanks I think I understand it Smile