Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

problem trying to randomize strings

Featured Replies

Trying to create a conversation, getting subtitles on keypress etc is all working great only thing that isn't working is when I try to randomize something from a list....:

private int dialogWithSuspectIndex = 0;
private int SuspectResponseIndex = 0;
private List<string> dialogWithSuspect = new List<string>()
    {
        "~r~Suspect~w~: line1",
        "~b~You~w~: line2.",
        "~r~Suspect~w~: line3",
        "~b~You~w~: line4"
    };
        private List<string> suspectResponse = new List<string>()
    {
        "~r~Suspect~w~: line5",
        "~r~Suspect~w~: line6",
        "~r~Suspect~w~: line7"
    };
...
...
...
public override void Process
{
  SuspectResponseIndex = General.Random.Next(0, 3);
  dialogWithSuspect.Add(suspectResponse[SuspectResponseIndex]);
  
  if (IsTask3Done == true && player.Position.DistanceTo(Suspect) <= 4)
            {
                if (Game.IsKeyDown(Settings.TalkKey))
                {
                    if (dialogWithSuspectIndex < dialogWithSuspect.Count)
                    {
                        Game.DisplaySubtitle(dialogWithSuspect[dialogWithSuspectIndex]);
                        dialogWithSuspectIndex = dialogWithSuspectIndex + 1;
                    }
                }
            }  
}  

what isn't working is the SuspectResponseIndex part, what I am guessing is that it is randomizing the common.random.next part infinetly because when I get to the suspectResponse part it keeps playing either line5, line6 or line7....just asking for a away to only play one randomized string.

no more help needed, darkmyre helped me out.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.