Assistance with programming at the start

Discussion in 'RGSS3 Script Requests' started by Home Inspired Studios, Nov 21, 2016.

  1. Home Inspired Studios

    Home Inspired Studios Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English
    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.
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,311
    Likes Received:
    6,437
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    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.
     
    #2
  3. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    798
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    You could try this snippet:

    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. :p


    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.
     
    #3
  4. Home Inspired Studios

    Home Inspired Studios Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English


    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 :(
     
    #4
  5. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    798
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    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.
     
    #5
  6. Home Inspired Studios

    Home Inspired Studios Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English
    Alright, I think I can figure it out from there. Thanks ^^
     
    #6

Share This Page