Assistance with programming at the start

I am making a game called Friday Night Slaughter, and I want the player to only be able to play it on a Friday. I was wondering if there was some way for the game to read the date, and if this is something I can program into the title screen instead of them entering the game and then me having to kick them out.

PS: Yes I know this will be able to be cheated by changing the date on the computer. That is part of the fun.
If it could be done, then only by scripts - nothing in the default engine can read computer data


I've moved this thread to Ace Script Request. Please be sure to post your threads in the correct forum next time. Thank you.
You could try this snippet:

Spoiler
class Window_TitleCommand < Window_Command

def window_width
return @rwidth.nil? ? 160 : @rwidth
end

alias friday_check8881 make_command_list
def make_command_list
t = Time.now
if t.wday != 5
add_command("Ohh, noes! Today is not a Friday!", :shutdown)
else
friday_check8881
end
resize_win
end

def resize_win
ww = 160 - standard_padding * 2 - 8
dummy = Bitmap.new(1,1)
@list.each do |cmd|
tw = dummy.text_size(cmd[:name]).width
ww = tw if tw > ww
end
@rwidth = ww + standard_padding * 2 + 8
dummy.dispose
end

end



It removes all of the regular command options from the title screen if it is not Friday.


Instead of the regular commands, it will only display one, and that one will close the game if the player confirms it.


You can change the command's name if you want, it shouldn't be hard to find where is it. 😛


Also, the window will scale to the text, so you can enter whatever you want and it will be displayed without getting cut down, unless it's width is bigger than your game's resolution.
You could try this snippet:

Spoiler
class Window_TitleCommand < Window_Command

def window_width
return @rwidth.nil? ? 160 : @rwidth
end

alias friday_check8881 make_command_list
def make_command_list
t = Time.now
if t.wday != 5
add_command("Ohh, noes! Today is not a Friday!", :shutdown)
else
friday_check8881
end
resize_win
end

def resize_win
ww = 160 - standard_padding * 2 - 8
dummy = Bitmap.new(1,1)
@list.each do |cmd|
tw = dummy.text_size(cmd[:name]).width
ww = tw if tw > ww
end
@rwidth = ww + standard_padding * 2 + 8
dummy.dispose
end

end



It removes all of the regular command options from the title screen if it is not Friday.


Instead of the regular commands, it will only display one, and that one will close the game if the player confirms it.


You can change the command's name if you want, it shouldn't be hard to find where is it. 😛


Also, the window will scale to the text, so you can enter whatever you want and it will be displayed without getting cut down, unless it's width is bigger than your game's resolution.



This looks like it SHOULD work, but with my experience, no matter which way I plug this into the Script Editor, I can't seem to get it functional. I either come up with an error or it bypasses the code entirely and acts as if I didn't change anything 🙁
You just put it anywhere between the Main and Materials section in the script editor.


If you use a custom title screen script, this should go below that one.


If you are new to script usage, I suggest you check out that "How to use a script" topic linked in Andar's signature.
Alright, I think I can figure it out from there. Thanks ^^

Original thread: https://forums.rpgmakerweb.com/threads/assistance-with-programming-at-the-start.71259/