WatchNon-threaded

Forums » Advanced Editor Forum » Read Message

Talk about it. Ask for help on it. Compliment it.

Scripting a functioning in game phone

one year ago

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) 

 

 

 

Scripting a functioning in game phone

one year ago
Go ahead and add me to the test game if you want and I'll take a look at exactly what you're trying to do after work. It all seems pretty simple up to the point when it's suddenly not, but I have confidence in my ability to take what should be complex things and fake them with shitty hack work.

Awesome to see you working on a game again btw. I saw you were logged in awhile yesterday but didn't think you'd make it over to the forum.

Scripting a functioning in game phone

one year ago

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. 

Scripting a functioning in game phone

one year ago

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. 

Scripting a functioning in game phone

one year ago
This would be the way to go if there was just one conversation, but in this case it needs to track what's been said to several NPCs. One variable per person may be enough though, I'll be able to look at it soon.

Scripting a functioning in game phone

one year ago

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.

Scripting a functioning in game phone

one year ago

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.

Scripting a functioning in game phone

one year ago
Excellent, I knew if I avoided sitting down at my computer long enough you would figure it out on your own!

Good job, me.

Scripting a functioning in game phone

one year ago

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

Scripting a functioning in game phone

one year ago

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"

Scripting a functioning in game phone

one year ago
You can use html for formatting in $PAGETEXT, just separate it from the rest like $PAGETEXT := $PAGETEXT + "[br /] [br /]" + "Blah blah" + "[br /] [br /]" + "blah blah blah."

And use actual html tags of course.

Scripting a functioning in game phone

one year ago

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

Scripting a functioning in game phone

one year ago
Good luck! Looking forward to reading it.

Scripting a functioning in game phone

one year ago
Yeah, if it's all smushed together, just as some br tags and all will be good.

Scripting a functioning in game phone

one year ago
It's worth noting this could have also been done on the page itself using the onpage variable code, but this way is fine too. It can be kind of finicky though. Like, you need to make sure each chain of checks only checks one variable, etc.

And yeah, you can't really get around needing a unique variable for every text.

Scripting a functioning in game phone

one year ago

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.