SphereCommunity
my little problem - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: my little problem (/Thread-my-little-problem)



my little problem - jexnico - 01-03-2018 04:39 PM

well, i just wanted to show a [Newbie] tag on top of the newbies items, but the message is showing up on all items, even if they are not newbies

04:37:ERROR:(e_player.scp,1194)Can't resolve <attr>
04:37:ERROR:(e_player.scp,1194)Undefined symbol ''
04:37:ERROR:(e_player.scp,1194)Undefined symbol 'newbie'

Quote:[EVENTS e_newbie]
ON=@ItemClick
IF <attr>=newbie
ACT.MESSAGE [Newbie]
ACT.MESSAGE @<ACT.COLOR> <ACT.NAME>
RETURN 1
ENDIF

anyone help me?


RE: my little problem - darksun84 - 01-03-2018 07:32 PM

Code:
[EVENTS e_newbie]
ON=@ItemClick
IF <ACT.attr> & attr_newbie
ACT.MESSAGE [Newbie]
ACT.MESSAGE @<ACT.COLOR> <ACT.NAME>
RETURN 1
ENDIF

For checking attr,flags and so on you must use the & operator, see http://wiki.spherecommunity.net/index.php?title=Bitwise_Operations
Also inside the ATTR (or flags for character) property, you can store only values that you can find in sphere_defs.scp
Suggested reading:
http://wiki.spherecommunity.net/index.php?title=Chapter_1


RE: my little problem - jexnico - 01-04-2018 01:43 AM

(01-03-2018 07:32 PM)darksun84 Wrote:  
Code:
[EVENTS e_newbie]
ON=@ItemClick
IF <ACT.attr> & attr_newbie
ACT.MESSAGE [Newbie]
ACT.MESSAGE @<ACT.COLOR> <ACT.NAME>
RETURN 1
ENDIF

For checking attr,flags and so on you must use the & operator, see http://wiki.spherecommunity.net/index.php?title=Bitwise_Operations
Also inside the ATTR (or flags for character) property, you can store only values that you can find in sphere_defs.scp
Suggested reading:
http://wiki.spherecommunity.net/index.php?title=Chapter_1

im working it


RE: my little problem - jexnico - 01-04-2018 05:12 AM

i've managed to get a label to appear on top of the items inside the game, but its popping up for all items, even for the non-newbies

the script stayed like this

Quote:[EVENTS e_newbie]
ON=@ItemClick
IF <FLAGS==00004>
ACT.MESSAGE [Newbie]
ACT.MESSAGE @<ACT.COLOR> <ACT.NAME>
RETURN 1
ENDIF

[EOF]

i want it to appear only for newbie items
[Image: 2h4fggx.png]


RE: my little problem - darksun84 - 01-04-2018 06:06 AM

The Flags property is for characters (players and npcs), while the Attr property is for items, so you have to check for the attr property with the & operator not the == ( see http://wiki.spherecommunity.net/index.php?title=Bitwise_Operations )

Your if will look like

Code:
[EVENTS e_newbie]
ON=@ItemClick
IF <act.attr> & attr_newbie  //If you look in sphere_defs you will see that the string attr_newbie is 04
ACT.MESSAGE [Newbie]
ACT.MESSAGE @<ACT.COLOR> <ACT.NAME>
RETURN 1
ENDIF



RE: my little problem - jexnico - 01-04-2018 06:30 AM

(01-04-2018 06:06 AM)darksun84 Wrote:  The Flags property is for characters (players and npcs), while the Attr property is for items, so you have to check for the attr property with the & operator not the == ( see http://wiki.spherecommunity.net/index.php?title=Bitwise_Operations )

Your if will look like

Code:
[EVENTS e_newbie]
ON=@ItemClick
IF <act.attr> & attr_newbie  //If you look in sphere_defs you will see that the string attr_newbie is 04
ACT.MESSAGE [Newbie]
ACT.MESSAGE @<ACT.COLOR> <ACT.NAME>
RETURN 1
ENDIF

worked for me!!!!!!
ty dude, you is my hero