The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set timer of any item
Author Message
Russian
Journeyman
*

Posts: 75
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 0



Post: #1
Set timer of any item
Hello!

I create GM sphere, this gm sphere can set time of live any item:
Code:
[ITEMDEF I_GM_ITEM_TIMER_SPHERE]
NAME=Set timer on item sphere
ID=I_CRYSTAL_BALL

ON=@CREATE
COLOR=0BAE
ATTR=ATTR_NEWBIE

ON=@DCLICK
TARGET
RETURN 1

ON=@TARGON_ITEM
SRC.DIALOGCLOSE D_GM_SET_TIMER
SRC.DIALOG D_GM_SET_TIMER
RETURN 1

[DIALOG D_GM_SET_TIMER]
...

[DIALOG D_GM_SET_TIMER BUTTON]
...

ONBUTTON=1
SRC.TARG.TIMER=<ARGTXT[0]>
SRC.TARG.TIMERF=<ARGTXT[0]>
SRC.TARG.ATTR=ATTR_CAN_DECAY
SRC.DIALOGCLOSE D_GM_SET_TIMER
SRC.SYSMESSAGE @0486,,1 Seconds left: <SRC.TARG.TIMER>
RETURN 1
But after time left, the items not removed and i got error:
[Image: ztd8jc.jpg]
11-18-2014 04:57 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Set timer of any item
try with attr_decay
(This post was last modified: 11-18-2014 05:20 AM by darksun84.)
11-18-2014 05:20 AM
Find all posts by this user Like Post Quote this message in a reply
Feeh
Sphere Developer
*****

Posts: 156
Likes Given: 6
Likes Received: 40 in 29 posts
Joined: Sep 2012
Reputation: 4



Post: #3
RE: Set timer of any item
Use the @TIMER trigger
return 0 will delete the item no matter if you have or not the attr_decay flag and default actions will take place
return 1 will stop any default action, the item will NOT decay and this message will not show

Feeh/Epila - Nightly releases / SphereWiki / Github Issues / Sphere's GitHub
11-18-2014 07:19 AM
Find all posts by this user Like Post Quote this message in a reply
Russian
Journeyman
*

Posts: 75
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 0



Post: #4
RE: Set timer of any item
(11-18-2014 05:20 AM)darksun84 Wrote:  try with attr_decay
Does not help, because after equip/unequip item - it set timer=-1

(11-18-2014 07:19 AM)Feeh Wrote:  Use the @TIMER trigger
return 0 will delete the item no matter if you have or not the attr_decay flag and default actions will take place
return 1 will stop any default action, the item will NOT decay and this message will not show
I want create function/item, what set to ANY item a timer. You advise to add to EACH subject trigger @TIMER?

My not worked script:
Code:
[ITEMDEF I_GM_ITEM_TIMER_SPHERE]
NAME=Set timer on item sphere
ID=I_CRYSTAL_BALL

ON=@CLICK
MESSAGE @0487,,1 Сфера установки временных предметов
RETURN 1

ON=@CREATE
COLOR=0BAE
ATTR=ATTR_NEWBIE

ON=@DCLICK
TARGET
RETURN 1

ON=@TARGON_ITEM
IF (<SRC.TARG.ATTR> & ATTR_DECAY)
RETURN 1
ELSE
SRC.DIALOGCLOSE D_GM_SET_TIMER
SRC.DIALOG D_GM_SET_TIMER
RETURN 1
ENDIF

ON=@TARGON_CHAR
RETURN 1

[DIALOG D_GM_SET_TIMER]
133, 27
RESIZEPIC 0 0 83 144 88
RESIZEPIC 17 16 3000 72 27
DTEXTENTRY 23 19 300 30 0 0 <SRC.TARG.TIMER>
BUTTON 97 21 4023 4025 1 0 1

[DIALOG D_GM_SET_TIMER BUTTON]
ONBUTTON=0
RETURN 1

ONBUTTON=1
SRC.TARG.TIMER=<ARGTXT[0]>
SRC.TARG.ATTR=ATTR_DECAY
SRC.DIALOGCLOSE D_GM_SET_TIMER
SRC.SYSMESSAGE @0486,,1 Seconds left: <SRC.TARG.TIMER>
RETURN 1
(This post was last modified: 11-18-2014 03:56 PM by Russian.)
11-18-2014 03:54 PM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #5
RE: Set timer of any item
SRC.TARG.TIMERF <ARGTXT[0]>,REMOVE

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
11-18-2014 11:13 PM
Find all posts by this user Like Post Quote this message in a reply
Russian
Journeyman
*

Posts: 75
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 0



Post: #6
RE: Set timer of any item
Worked script:
Code:
[ITEMDEF I_GM_ITEM_TIMER_SPHERE]
NAME=Set timer on item sphere
ID=I_CRYSTAL_BALL

ON=@CLICK
MESSAGE @0487,,1 Сфера установки временных предметов
RETURN 1

ON=@CREATE
COLOR=0BAE
ATTR=ATTR_NEWBIE

ON=@DCLICK
TARGET
RETURN 1

ON=@TARGON_ITEM
IF (<SRC.TARG.ATTR> & ATTR_CAN_DECAY)
RETURN 1
ELSE
SRC.DIALOGCLOSE D_GM_SET_TIMER
SRC.DIALOG D_GM_SET_TIMER
RETURN 1
ENDIF

ON=@TARGON_CHAR
RETURN 1

[DIALOG D_GM_SET_TIMER]
133, 27
RESIZEPIC 0 0 83 144 88
RESIZEPIC 17 16 3000 72 27
DTEXTENTRY 23 19 300 30 0 0 <SRC.TARG.TIMER>
BUTTON 97 21 4023 4025 1 0 1

[DIALOG D_GM_SET_TIMER BUTTON]
ONBUTTON=0
RETURN 1

ONBUTTON=1
SRC.TARG.ATTR=ATTR_CAN_DECAY
SRC.TARG.TIMERF <ARGTXT[0]>,REMOVE
SRC.TARG.TIMER=<ARGTXT[0]>
SRC.DIALOGCLOSE D_GM_SET_TIMER
SRC.SYSMESSAGE @0486,,1 Seconds left: <SRC.TARG.TIMER>
RETURN 1
Thank you for help!
11-19-2014 03:51 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)