pinku
Journeyman
Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4
|
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 |
|
|
darksun84
Sir Spamalot
Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35
|
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 |
|
|
x77x
Master
Posts: 488
Likes Given: 0
Likes Received: 15 in 15 posts
Joined: Mar 2012
Reputation: -4
|
|
11-15-2013 02:47 PM |
|
|
RanXerox
Master
Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19
|
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 |
|
|