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-nmm6 (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-nmm6 (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-nmm6 (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
Rentable Room Script
Author Message
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #1
Rentable Room Script
Found on downloads section:

Code:
[comment]
Add this to your innkeeper speech file:

ON=*check out*
ON=*checkout*
ON=*leave*
SRC.F_CHECKOUT <UID>

Add this to your innkeeper sell template

SELL=I_KEY_RENTAL_YEAR,{5 10}
SELL=I_KEY_RENTAL_MONTH,{5 10}
SELL=I_KEY_RENTAL_WEEK,{5 10}
SELL=I_KEY_RENTAL_DAY,{5 10}

Add the event: T_DOOR_RENTAL to the doors of all rentable rooms in the inn.

Make sure you also add a I_SIGN_CHECKOUT in each room so that if the key expires while the player is in the room, they wont be locked in.

[TYPEDEF T_DOOR_RENTAL]

[TYPEDEF T_KEY_RENTAL]
ON=@DCLICK
IF (<TAG.LINKED>==0)
    TARGETF F_RENTAL_LINK <UID>
    RETURN 1
ELSE
    RETURN 0
ENDIF

on=@DROPON_CHAR
IF (STRMATCH(*innkeeper*, <UID.<ARGO>.ID>)
    IF (<TAG.EXPIRED>==1)
        ARGO.SAY Thankyou <SRC.NAME>! Please come again.
        remove
    ENDIF
ENDIF

[ITEMDEF I_KEY_RENTAL_DAY]
ID=I_KEY_IRON
name=Rental (1 Day)
VALUE=100
TEVENTS=T_KEY_RENTAL

ON=@CREATE
TAG.EXPIRE=1*60*24
TAG.LINKED=0

[ITEMDEF I_KEY_RENTAL_WEEK]
ID=I_KEY_IRON
name=Rental (1 Week)
VALUE=500

ON=@CREATE
TAG.EXPIRE=7*60*24
TAG.LINKED=0
EVENTS=T_KEY_RENTAL

[ITEMDEF I_KEY_RENTAL_MONTH]
ID=I_KEY_IRON
name=Rental (1 Month)
VALUE=2500

ON=@CREATE
TAG.EXPIRE=30*60*24
TAG.LINKED=0
EVENTS=T_KEY_RENTAL

[ITEMDEF I_KEY_RENTAL_YEAR]
ID=I_KEY_IRON
name=Rental (1 Year)
VALUE=20000

ON=@CREATE
TAG.EXPIRE=365*60*24
TAG.LINKED=0
EVENTS=T_KEY_RENTAL

[FUNCTION F_RENTAL_LINK]

//say ARGN1= <uid.<ARGN1>.name>
//say name = <name>
//say SRC= <src.name>

IF !(<ARGO.EVENTS>==T_DOOR_RENTAL)
    SYSMESSAGE=This key does Not fit that lock!(not a rental door)
    RETURN 1
ELIF(<EVAL 0<ARGO.TAG.LINKED>>==1)
    SYSMESSAGE=This key does not fit that lock! (Door already rented out)
    RETURN 1
ELSE
    ARGO.TAG.LINKED=1
    argo.MORE1=<UID.<ARGN1>.UID>
    ARGO.MESSAGE=Linked!
    TRY UID.<ARGN1>.TAG.LINKED=1
    TRY UID.<ARGN1>.LINK=<ARGO.UID>
    TRY UID.<ARGN1>.MORE1=<UID.<ARGN1>.UID>
    TRY UID.<ARGN1>.TIMERF=<EVAL <UID.<ARGN1>.TAG.EXPIRE>> F_RENTAL_EXPIRE
    TRY UID.<ARGN1>.NAME Rental Key (<room.name>)
    TRY UID.<ARGN1>.MESSAGE=Linked!
    RETURN 1
ENDIF

[FUNCTION F_RENTAL_EXPIRE]
MESSAGE=The <name> has expired!
TAG.EXPIRED=1
SRC.CTAG.EXPIRINGKEY=<UID>
IF (<SRC.ISINRENTAL>==1)
    //SRC.SAY I'm in the Inn
    SRC.FINDINNKEEPER
    //say <src.tag.inkeeper>
    src. f_checkout <src.tag.innkeeper>
    src.tag.innkeeper=
ENDIF
LINK.TAG.LINKED=0
LINK.TYPE T_DOOR_LOCKED
LINK.MORE1=1
Return 1

[FUNCTION ISINRENTAL]
//SAY key=<uid.<CTAG.EXPIRINGKEY>.MORE1>
FORITEMS 7
    //SAY Door=<MORE1>
    IF (<MORE1>==<uid.<SRC.CTAG.EXPIRINGKEY>.MORE1>)
        RETURN 1
    ENDIF
ENDFOR


[FUNCTION FINDINNKEEPER]
//SAY I'm looking for the Innkeeper
forchars 15
    IF (STRMATCH(*innkeeper*, <ID>))
        src.tag.innkeeper=<uid>
    ENDIF
ENDFOR

[FUNCTION F_CHECKOUT]
FORCONTID i_key_rental_DAY 10
       IF (<EVAL <TAG.EXPIRED>>==1)
        TRY UID.<ARGN1>.SAY Thank you <src.name>! Please come again.
        SRC.go <UID.<ARGN1>.P>
        REMOVE
        RETURN 1
    ENDIF
ENDFOR
FORCONTID i_key_rental_week 10
       IF (<EVAL <TAG.EXPIRED>>==1)
        TRY UID.<ARGN1>.SAY Thank you <src.name>! Please come again.
        SRC.go <UID.<ARGN1>.P>
        REMOVE
        RETURN 1
    ENDIF
ENDFOR
FORCONTID i_key_rental_month 10
       IF (<EVAL <TAG.EXPIRED>>==1)
        TRY UID.<ARGN1>.SAY Thank you <src.name>! Please come again.
        SRC.go <UID.<ARGN1>.P>
        REMOVE
        RETURN 1
    ENDIF
ENDFOR
FORCONTID i_key_rental_year 10
       IF (<EVAL <TAG.EXPIRED>>==1)
        TRY UID.<ARGN1>.SAY Thank you <src.name>! Please come again.
        SRC.go <UID.<ARGN1>.P>
        REMOVE
        RETURN 1
    ENDIF
ENDFOR
    
[ITEMDEF I_SIGN_CHECKOUT]
ID=0bcf
NAME=Check Out

on=@create
ATTR=0c000

on=@dclick
forchars 10
    IF (STRMATCH(*innkeeper*, <ID>))
        src.tag.innkeeper=<uid>
    ENDIF
ENDFOR
say <src.tag.inkeeper>
src. f_checkout <src.tag.innkeeper>
Return 1

I'm trying it.. but does not work..
Before trying, I made sure I set the door event with .xevents T_DOOR_RENTAL

After that, I double click the key and link to the door.
It says "Linked" and then, does not work anymore.
Keeps saying when I try to lock the door with the key:

"The key does not fit into that lock."

Any ideas? I can't get it..
11-15-2013 04:24 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: Rentable Room Script
Try this, change

PHP Code:
IF !(<ARGO.EVENTS>==T_DOOR_RENTAL

with

PHP Code:
IF !(<ARGO.isevent>==T_DOOR_RENTAL
11-15-2013 05:14 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #3
RE: Rentable Room Script
The syntax for isevent is more like this I think:

PHP Code:
IF !(<ARGO.isevent.T_DOOR_RENTAL>) 
11-15-2013 05:30 AM
Find all posts by this user Like Post Quote this message in a reply
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #4
RE: Rentable Room Script
Now it does work, however, there is still an issue.
I can use a new key on the same door taken before.. Again, it's giving me no errors on console, so I'm pretty confused.

Seems like this checker isn't working:

ELIF(<EVAL 0<ARGO.TAG.LINKED>>==1)
SYSMESSAGE=This key does not fit that lock! (Door already rented out)
RETURN 1
11-15-2013 07:12 AM
Find all posts by this user Like Post Quote this message in a reply
x77x
Master
**

Posts: 488
Likes Given: 0
Likes Received: 15 in 15 posts
Joined: Mar 2012
Reputation: -4



Post: #5
RE: Rentable Room Script
can you rent it by the hour?

Dragons of Time 2000-2020
http://dragonsoftime.com
11-15-2013 02:47 PM
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: #6
RE: Rentable Room Script
(11-15-2013 07:12 AM)pinku Wrote:  Now it does work, however, there is still an issue.
I can use a new key on the same door taken before.. Again, it's giving me no errors on console, so I'm pretty confused.

Seems like this checker isn't working:

ELIF(<EVAL 0<ARGO.TAG.LINKED>>==1)
SYSMESSAGE=This key does not fit that lock! (Door already rented out)
RETURN 1

Just tested, the problem is there is no blank space between ELIF and the condition Veryhappy
11-16-2013 01:27 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #7
RE: Rentable Room Script
PHP Code:
ELIF(<EVAL 0<ARGO.TAG.LINKED>>==1

...is unnecessarily complicated, you can do this instead:

PHP Code:
ELIF (<ARGO.TAG0.LINKED>) 

The () marks in an IF statement imply it is to be evaluated, and putting the 0 after the keyword TAG prevents an error from being thrown if the TAG does not exist. The condition will be true when the TAG has any value other than zero, so testing specifically for the value of 1 is not necessary.
11-16-2013 04:53 AM
Find all posts by this user Like Post Quote this message in a reply
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #8
RE: Rentable Room Script
Well, it works very well.. until I open the door.. lol

Does anyone else have this problem? I don't think it's related to my house system, but who knows?
11-16-2013 04:52 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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