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
sand cly mining 1.1 script
Author Message
kn4tseb
Master
**

Posts: 392
Likes Given: 45
Likes Received: 10 in 10 posts
Joined: May 2014
Reputation: 0



Post: #1
sand cly mining 1.1 script
Hello boys, im trying to implement this great script idea but im getting some issues with functions, its a bit more advance of my current knowledge so i cant find what's wrong with it... it works 'till "success" function, i will post it and any help will be appreciate it.

i will only paste Sand mining side:

when it success it makes the animation of mining, create the invisible copper coin, and nothing else happens
i also get some errors @ console:
17:32:ERROR:Timer expired without DECAY flag 'sand' (UID=040016a7e)?
17:32:ERROR:Timer expired without DECAY flag 'sand' (UID=040016a7c)?

PHP Code:
ON=@TARGON_GROUND
IF (<serv.map(<src.targp.x>,<src.targp.y>,<src.targp.z>,<src.targp.m>).type>==t_rock)
    RETURN 
0
ENDIF
IF (<
serv.map(<src.targp.x>,<src.targp.y>,<src.targp.z>,<src.targp.m>).type>==t_sand)
    IF (<
DISTANCE <SRC.TARGP>> >= 3)    
        
SRC.SYSMESSAGE That is too far away, try mining closer
        
RETURN 1
    
ENDIF
    IF  !<
SRC.CANSEELOS <SRC.TARGP>> 
        
SRC.SYSMESSAGE I cannot see thathow am i supposed to mine it?
        RETURN 
1
    
ENDIF
    
LOCAL.MINE=(<SRC.MINING>/100)    
    IF (<
R2> < <EVAL <LOCAL.MINE>>)
        
src.f_sand_success
    
ELSE
        
src.f_sand_fail
    
ENDIF
    RETURN 
1
ENDIF

[FUNCTION 
f_sand_success]
SRC.TIMERF 1f_check_sand_resources
IF !(<SRC.CTAG0.RESOURCE>)
    
SRC.ANIM 11
    sfx 0340
    NEWITEM
=i_coin_copper
    
NEW.ATTR=attr_move_never|attr_invis|attr_decay
    
NEW.MORE2=i_sand
    
NEW.AMOUNT=<EVAL {3 6}>
    NEW.
TIMER=60*10
    
NEW.P=<SRC.TARGP>
    
SRC.CTAG.RESOURCE=<NEW.UID>
    RETURN 
1
ENDIF
IF (<
UID.<SRC.CTAG0.RESOURCE>.AMOUNT> > 0)
    
SRC.TIMERF 1f_sand_mine_action
    
RETURN 1
ELSE
    
SRC.SYSMESSAGE There is nothing here to mine.
ENDIF

[FUNCTION 
f_check_sand_resources]
SRC.ANIM 11
sfx 0340
CTAG
.RESOURCE=
VAR.
RESOURCE=
VAR.
OLD_ACT=<ACT.UID>
NEWITEM=i_memory
NEW.P=<TARGP>
NEW.
f_check_sand_resources_p
NEW.REMOVE
IF (<VAR0.RESOURCE>)
    
CTAG.RESOURCE=<VAR0.RESOURCE>
ENDIF
VAR.
RESOURCE=

[FUNCTION 
f_check_sand_resources_p]
FORITEMS 0
    
IF (<BASEID>==i_coin_copper)
        IF (<
MORE2>==i_sand)
            VAR.
RESOURCE=<UID>
        ENDIF
    ENDIF
ENDFOR

[FUNCTION 
f_sand_mine_action]
IF (<
SRC.CTAG0.anim> <= 3)
    
SRC.ANIM 11
    SRC
.SFX 0340
    SRC
.CTAG0.anim += 1
    TIMERF 1
f_sand_mine_action
ELSE
SRC.CTAG.ANIM=
f_sand_mine
ENDIF

[FUNCTION 
f_sand_mine]
TRY 
UID.<SRC.CTAG0.RESOURCE>.AMOUNT=<UID.<SRC.CTAG0.RESOURCE>.AMOUNT> +-1
TRY UID.<SRC.CTAG0.RESOURCE>.UPDATE
SRC
.ANIM 11
sfx 0340
NEWITEM
=<UID.<SRC.CTAG0.RESOURCE>.MORE2>
NEW.
BOUNCE
ENDIF 
(This post was last modified: 06-03-2014 10:16 AM by kn4tseb.)
06-03-2014 07:10 AM
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: #2
RE: sand cly mining 1.1 script
Set attr_decay on items.

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.
06-03-2014 12:05 PM
Find all posts by this user Like Post Quote this message in a reply
kn4tseb
Master
**

Posts: 392
Likes Given: 45
Likes Received: 10 in 10 posts
Joined: May 2014
Reputation: 0



Post: #3
RE: sand cly mining 1.1 script
done, no more errors, thanks; but script still doesnt work >.<
when it "success", some "invisible" copper coins are created at <TARGP> i suppose its some kind of memory so that tile will not be able to mine for a time... but i miss it when fallowing functions are called... specially with the CTAG, because one the coins are created nothing else happens, i can even mine the same spot as much as i can..

if i could only understand what it does, would be a huge step forward learning this ^^
(This post was last modified: 06-03-2014 12:32 PM by kn4tseb.)
06-03-2014 12:25 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: #4
RE: sand cly mining 1.1 script
Look if this help you


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.
06-03-2014 02:12 PM
Find all posts by this user Like Post Quote this message in a reply
kn4tseb
Master
**

Posts: 392
Likes Given: 45
Likes Received: 10 in 10 posts
Joined: May 2014
Reputation: 0



Post: #5
RE: sand cly mining 1.1 script
gonna check them, thank you ^^
06-03-2014 02:55 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)