Alright, I've got about 6 years worth of rust on my scripting skills.
I think I know how to do what I want, but I'd like a second opinion(or ten) on whether I'm going in the right direction or even possibly overcomplicating it.
So what I'm trying to accomplish is a cell phone item. When that item is used it directs the player to a home page for the phone. From there they can access various contacts with npcs they have met in the game. From those contacts they can then view text message convos that have happened previously in the game or attempt to call the npc.
What I've done so far is base the phone script off the codex script(Only difference is the iscodex variable is isphone in my script). I have that functioning properly. So the player can access the phone, use it, then return to the story exactly where they were no problem. I've also got the script working to show contacts for what npcs the player has met and hide the ones they haven't.
What I need an opinion on going forward is the two scripts for calling the NPCs and reading the past text messages.
My idea for the phone call script is to keep the actual phone call conversation within the "codex" so that it does not effect the player's place in the game. I'd set up a variable for each NPC that can be tripped from 0 to 1 if the player is located on a page where I want them to be capable of calling a certain npc to trigger an interaction with that NPC. The script would also read which page the player is on to calculate which interaction it sends them to. I can do that simply enough, but I want to make sure I'm being efficient.
Now for the one where I know I'm not being efficient. The previous text message conversations. I don't plan on having a ton of them in the story, but I do want to have a dialogue system so that the conversations are based on player choice. And I need the text messages to show up in the correct order and the correct choice of dialogue the player went with. I know how to do it in theory, but the way I know to make it work involves an unholy amount of variables. Literally a variable for every text to account for which option the player chose. Then script the page to show the correct text based on those variables. I'm willing to do that, but if anyone knows a simpler way you'll be my hero for all of eternity.
(If anyone wants to have a look at how it works I set up a storygame just for script testing that I'd be happy to show if you let me know. I just haven't finished the scripting for some of it yet)
I'm adding you as a co author now. I've almost got the call function working correctly.
Thank you! I'm glad to be back. I've really missed working on games on here and the community.
I only have a very basic understanding of variables/coding, but I do have an idea, if it's possible at all. Someone more knowledgeable than me on the subject would need to come along to figure out how exactly it could work, specifically the code used in the editor here. I'm thinking rather than a ton of variables, maybe it would be possible to have a single variable like TEXTNUMBER(then a number from one to however many you need), each text would have it's own number that corresponds to it. IF TEXTNUMBER = (Whatever) have it show that corresponding text. Then maybe you could use greater than, less than type stuff to get them to show in the correct order, and some type of log that records all the previous TEXTNUMBER = 1, 2, 4, 7, 8, etc. Then have the code read that and put them in the correct order when they need to be displayed.
If all that makes no sense whatsoever do disregard me entirely, but it's an idea, and if it's possible I figure putting it out there someone else that knows more about the coding needed for the editor here might be able to put it into a format that might help. I intend to get into the editor and coding here someday, just haven't quite messed with it yet. Whether this helps at all or not, I wish you the best of luck on your story, and getting everything working.
Hmm, if there is a way to divide them up by character in the log that keep tracks of which texts you choose it might still work, because the text numbers themselves I wouldn't think of as being limited so you could set aside 1-100 for one character 101 - 200 for another and so on. Then when you click the thing to check "NPC 2" it would read the log for values between 101 -200 and display only those in order again based on the greater than less than code. Then you would be able to use the exact same variable/system for the entire thing.
Happy to hear my initial idea had some merit. Thank you for looking at it. Hope it all comes together well, it's a cool idea to have a working cell phone in a game.
I actually had some time today to get around to attempting to work on the text message part of the script and pretty much did what you are suggesting. Great minds think alike lol!
The way I have done it is a variable per character per text conversation. So NPC1Text1 is the variable for example and then the variable accounts for which option they chose (1,2, or 3) in the first conversation with that NPC. Unfortunately I can't use the same variable for all of the text convos for a single character. The second the player has another conversation then it will override the previous one and the text will change accordingly. However your idea of a single variable per NPC is a good one, it's exactly what I'm doing to track player/npc relationship in the game. Then it will effect player encounters with that NPC throughout the game based on that variable.
I don't plan on the game having a ton of text messaging in it so it shouldn't be too terribly time consuming especially since I'm working out the kinks in a test game. The issue I'm currently running into is getting it to display the correct text on the page where the player can read through the messages. Originally I did it with %%variable%=%1%Text%% But it just showed up as blank so now I'm about to stop being lazy with my scripting and dust off my $pagetext skills. That should fix the problem.
If it does then I've successfully got it all working, though I have no idea if it will hold up once I switch it over to use in my actual game with more complex branching conversations xD.
Well, actually. I'm a little stumped on having multiple $pagetext scripts on a single page and how to make it appear in the right order. So far I'm getting blank pages or some serious jumbles xD
I semi accidentally lied. I got it to show up in correct order and correct text but it's all smushed together. I'm currently hunting the help and info for how to fix that.
For future reference if anybody tries to do something similar to this. The script I used is this:
IF %NPC1TEXT1 = 1 THEN $PAGETEXT := $PAGETEXT + "Text Message shows player choice option 1.1" ELSE
IF %NPC1TEXT1 = 2 THEN $PAGETEXT := $PAGETEXT + "Text Message shows player choice option 1.2" ELSE
IF %NPC1TEXT1 = 3 THEN $PAGETEXT := $PAGETEXT + "Text Message shows player choice option 1.3"
$PAGETEXT := $PAGETEXT + "Second NPC Response"
IF %NPC1TEXT2 = 1 THEN $PAGETEXT := $PAGETEXT + "Text Message shows Player choice option 2.1" ELSE
IF %NPC1TEXT2 = 2 THEN $PAGETEXT := $PAGETEXT + "Text Message shows Player choice option 2.2" ELSE
IF %NPC1TEXT2 = 3 THEN $PAGETEXT := $PAGETEXT + "Text Message shows player choice option 2.3"
$PAGETEXT := $PAGETEXT + "3rd NPC text"
IF %NPC1TEXT3 = 1 THEN $PAGETEXT := $PAGETEXT + "Text Message shows player choice option 3.1" ELSE
IF %NPCTEXT3 = 2 THEN $PAGETEXT := $PAGETEXT + "Text Message shows player choice option 3.2" ELSE
IF %NPC1TEXT3 = 3 THEN $PAGETEXT := $PAGETEXT + "Text Message shows player choice option 3.3"
You are all things wonderful and good in this world. Thank you!
I can finally put this script to rest, implement it, and go back to actually working on my story. :D
I'm just happy my idea was actually viable, despite my not having a working knowledge of the code being used. I really need to learn more about it sometime, though probably just for fun. If I ever make a storygame myself, I don't see it being one of the more code heavy variety. I do find things like code fun to mess with and think about though, so who knows.
Good to hear that you're making progress on it. Best of luck getting the kinks worked out, and implementing it into your game.