....Okay.....
Well, you don't need a script to do this. There is a script that will change it from day to night, but that's not what you're asking about.
Okay, you need to start by creating some variables and a switch. You need to create 3 variables: one for the number os days the person wants the room, another for the number of days that have passed, and another for the amount of gold to charge the player. You'll aslo need to create a switch to turn on when the player receives the room key.
So, for example:
Variables:
001: Days
002: DaysPassed
003: Price
Switch:
001: RoomRented
All right, after you do that, you'll want to create a common event. Just go into your database and create a common event called 'Rent' or something like that. Set the trigger to none'.
On the event page, show a message reading something like "For how many days would you like the room?" and then use an "Input number.." process. Set the number of digits you want the player to be able to enter. If you don't want them renting the room for more than 9 days, just allow one digit. You also need to set the variable that this information will be stored into, which would be the variable "001: Days" from above.
Now, start the timer. Go to 'Control Timer" and set it at 0 min 0 sec to start. You'll also want to turn on the switch we set "001: RoomRented"
And, you need to give them the room key "Change Items", then set the amount of gold they have to pay. To do this, we want to control out variable "003: Price". First, set it equal to "001: Days", and then create another control to multiply it by a constant the represents the number of gold per day, maybe 100 gold or something. After that's done, create an event that will remove gold from that inventory equal to the variable 'Price'
So, you're event will look sort of like this:
@>Text: For how many days would you like to rent a room?"
@>Input Number: (001: Days) 1 digit(s)
@>Control Timer: Startup (0 min, 0 sec)
@>Control Switches: (001: RoomRented) = ON
@>Change Items: (Door Key) +1
@> Control Variables: (003) = (001)
@>Control Variables: (003) *= 100
@>Change Gold: - Variable (003)
And we'll add more to that after we create another common event.
So, do that. Create a second common event. Call it something like 'TimePassage'. This will be used to measure the number of days the player has had the room and will dispose of their room key. Set the trigger to "Parallel Process' and set the condition switch to "001: RoomRented".
Now, create a conditional branch. Set the condition that the variable "002: DaysPassed" is 'equal to' the variable "001: Days". You want the box checked that allows you to set actions for when the terms do not apply.
So, when this condition is met, you want to remove the room key from the player's inventory, stop the timer, and turn off the switch we made. This will disallow the player to get nto the room anymore.
Then, in the 'Else' section, we need to set the measure of time. We'll need to create another conditional branch. Let's say you want a day in your game to be 5 minutes in real time. Set the condition to the timer is at 5 minutes and 0 seconds or more, and this time uncheck the box to set events for when this isn't true, because we don't need it. Under this branch we want to manipulate our day counting variable "002: DaysPassed". Go to Control variables and choose 'Add' and the constant 1. Also, you'll need to stop the timer, and then create another even to restart it back at zero.
So, this even will look something like this:
@>Conditional Branch: Variable (002) == variable (002)
___@>Change Items: (Door Key) -1
___@>Control Switches: (001) = OFF
___@>Control Timer: Stop
___Else
___@>Conditional Branch: Timer 5 min, 0 sec or more
_____@>Control Variables: (002) += 1
_____@>Control Timer: Stop
_____@>Control Timer: Startup (0 min, 0 sec)
___Branch End
___@>
Branch End
All right, so now we want to go back to our other common event we created and call this one. So, add to it 'Call common event: "002:TimePassage".
So, yeah, there's a lot to it, but this should work. If you have any questions about something, just let me know! You can set the variables and swtiches to whatever name or ID you want, of course; I'm just giving examples.