AGS: How Do I Make An Phantasmagoria-Like Password-Protected Censorship Code?

Started by Will, Fri 03/08/2018 11:46:21

Previous topic - Next topic

Will

Okay, This May Be A Late Reply but...

@Cassiebsg

What did you mean about this code when creating a Hidden Save Game?
Code: ags
function on_event(EventType event, int data)
{
  if (event = eEventRestoreGame)
  {
     if (SavedGameslot==998)
     {
        SavedGameslot=0; // I'm not sure that seting this to 0 is needed, but I had it on my code, so I'll leave it here.
        // you can then read the info of your password setting and maybe display a message saying what level of censurship is the game now set to or what ever else you need to do
      }
  }
}
 


Where Do I put the Hidden Save File? In the GUI of My Enter Password GUI? Please Answer...
will :)

Khris

I don't think any of this is necessary.

If somebody decided to play the game a second time from the start, months or years later, surely they are willing to spend 5 seconds entering the uncensored password again...?

Cassiebsg

@Khris: Depends exactly what he wants to do.
On my game it was meant to remember that the game was "unlocked", and if the file wasn't found or was corrupt it would then revert to default which was "locked". I ended up dropping this since it seemed to confuse my testers. (laugh) And just gave a check box on the settings instead.

@Will: Yes, you put the code (the savegame line) inside your textbox onclick function and remember to set the censorship variable to the correct one.

You'll have something like:
Code: ags

function censor_OnClick() // or what ever your function it called)
{
  if (password_is_gore)
  {
    //do stuff
    censorship_variable=2; // assuming 0 is full censored, 1 is mild and 2 is full gore
    savegameslot(998, "censorship");
  }
  else if ( password_is_mild)
  {
    //do stuff
    censorship_variable=1; // assuming 0 is full censored, 1 is mild and 2 is full gore
    savegameslot(997, "censorship");
  }
  else
  {
    //do stuff
    Display("Wrong password");
  }
}

function game_start() // you should have this function already on global scripts
{
    if (Game.GetSaveSlotDescription(998)!=null) 
    {
        //set the game to uncensored mode... uhm... you want 2... maybe use 997 for one and 998 for another? Then remember to delete the one you don't want... like if full censor = delete 997 and 998, if it's in mild delete 998 and write 997, if full gore, delete 997 and write 998?
    censorship_variable=2; // assuming 0 is full censored, 1 is mild and 2 is full gore
    }
    else if  (Game.GetSaveSlotDescription(997)!=null)
    {
     // add code
    censorship_variable=1; // assuming 0 is full censored, 1 is mild and 2 is full gore
    }
}


Hope you can figure this out, this way you aren't actually loading the restore file, just checking if one or the other exist and setting the correct variable at game start.

Note: However, if you're adding this as "child protection" then you probably should not remember the censorship mode, and then all this is pointless... (roll)
There are those who believe that life here began out there...

Will

@Cassiebsg Is this okay/correct?
Code: ags
function tbPassword_OnActivate(GUIControl *control)
{
  if (tbPassword.Text == "My Password") //either whatever password I wanted
  {
    
    isGameUnlocked = true; //this is the variable that you showed me earlier before
    tbPassword.Text="";
    SaveGameSlot(998, "censored"); //the Hidden SaveGame Slot you said to me...
    Display("Password is Correct.");
  }
  else
  {
    tbPassword.Text="";
    Display("Wrong Password, Try Again!");
  }
}


That was when the Player will enter the Password in order to censor any disturbing details.

Code: ags
function btnEnter_OnClick(GUIControl *control, MouseButton button)
{
    if (Game.GetSaveSlotDescription(998)!=null) //this is when, in order to save the options and create a save file, they must press the "Enter" button, not the Enter key on the keyboard
    {
      isGameUnlocked = true;
    }
    else if (Game.GetSaveSlotDescription(997)!=null)
    {
      isGameUnlocked = false;
    }
}


Is that okay? I want to clarify if it is... If not, just tell me the right way how.
Thanks!
will :)

Cassiebsg

Yes, somewhat.

I thought you were doing 3 levels of censorship? Censored, mild and Gore? Or will you only have 2?

You might want to change the variable name from isGameUnlocked to something else that gives meaning in your code... maybe isGameCensored? I have made it an habit to start all my bools with a question... like is that way the answer gives perfect meaning and I don't need to add much more comments. ;) But feel free to name it whatever works for you.
If you only have to states: censor and non censored, you only on if (Game.GetSaveSlotDescription...

And uhm... why do you have two codes for the text box? You should set the variable to true when you save and accept the code, and to false when the password is wrong.

The if (Game.GetSaveSlotDescription check should be on function game_start(), so that it checks if the file exists or not when you launch the game and sets the variable accordingly.
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk