Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Newbie in need of assistance for "names"!

9 years ago

Hello, experienced people! I am a non-experienced person! I kind of get the basics on how to make a story game, but when it comes to making a name within the game, I am completely confused. I found the article "How to Create a Name in Your Game", but I get confused when it gets to the part about setting up the links. Can someone thoroughly explain the process of this please?

Newbie in need of assistance for "names"!

9 years ago
Hi,
You start by creating variables. DIGIT1 through DIGIT8 if you want to have a name with a maximum of 8 letters. Then, assuming that the max digits is 8, you create 8 pages, titled enter letter one, enter letter two and so on. You create a link on each page that links to the next one for each letter. For example, the link titled "A" on page "Enter Letter One" will lead to the page "Enter Letter Two" and also put a variable change on that link that will make DIGIT1 equal to 1, where 1 signifies A. You can also create a reset link on pages two through eight, which will lead back to one and set all the DIGIT variables to 0. You also create an enter page, where it would confirm the name. You would have links on every letter page to go to the enter page. I believe the massive string of text you have to put whenever you want the name to be displayed on the page is at the end of that article. I'm sorry if that made you even more confused, I'm just not sure how to explain it, heh.

Newbie in need of assistance for "names"!

9 years ago

That's ok. You explained it a little better than the article did, but I have one question. For the letters linked in the "enter letter 1" page, each letter should have a "DIGIT1" variable attached to it, and I select "addition" and then enter 1 for a, 2 for b, and so on, right?

Newbie in need of assistance for "names"!

9 years ago

Yes. The value for DIGIT1 should be set to the number corresponding with the letter selected (1 for 'A', 2 for 'B', etc).

Newbie in need of assistance for "names"!

9 years ago

I am going to describe to you a process that, while fundamentally the same as the one mentioned in the article, only uses one page to set the name.

This process requires:

  1. Advanced Scripting to be activated in Story Settings
  2. The digit variables described in the article
  3. A variable to represent the number of letters that has already been set (DIGITSET)

After you do that, go to the page on which you will allow the player to set their name and create 27 variables. Name the first twenty six after their corresponding letter in the alphabet (link 1 would be 'A', link 2 would be 'B', etc.). The last will be a link to another page.

Go to each of the letter links and click on the stop sign to set a restriction. The links should only appear if DIGITSET is less than the number of digit variables you have. So, if you have 8 digit variables, you would set each of the letter links to appear only if DIGITSET is less than 8.

Set a restriction on the last link so that it may only be used if DIGITSET is greater than 0.

Go to the script of each letter link and input:

IF %DIGITSET = 0 THEN %DIGIT1 := (number corresponding to letter)
IF %DIGITSET = 1 THEN %DIGIT2 := (number corresponding to letter)
IF %DIGITSET = 2 THEN %DIGIT3 := (number corresponding to letter)
IF %DIGITSET = 3 THEN %DIGIT4 := (number corresponding to letter)
IF %DIGITSET = 4 THEN %DIGIT5 := (number corresponding to letter)
IF %DIGITSET = 5 THEN %DIGIT6 := (number corresponding to letter)
IF %DIGITSET = 6 THEN %DIGIT7 := (number corresponding to letter)
IF %DIGITSET = 7 THEN %DIGIT8 := (number corresponding to letter)
%DIGITSET := %DIGITSET + 1

Replace the stuff in parantheses with the number corresponding to the letter the link is supposed to be setting (1 for 'A', 2 for 'B', etc.)If you have more than 8 digit variables, you will of course have to adjust the above script.

I believe the on-page script found in the article will still work for this system, assuming you only have eight digit variables. If you have more, you will of course have to adjust it.

On the actual page where the player will set the name, place the on-page script at the end. That way, the player can see what their name looks like at any point during the name setting process.

Newbie in need of assistance for "names"!

9 years ago

So, you're saying that I should make 27 variables instead of 26 different pages for letters? I'm sorry, but I don't want to mess this up.

Newbie in need of assistance for "names"!

9 years ago

What? You're not supposed to make 26 different pages for each letter of the alphabet. I'm not suggesting you make 27 variables either. What you are doing is making the eight DIGIT# variables and another variable to track how many of the digit variables you have set, making a single page with 27 links, and using page scripts and restrictions to do the rest.

Newbie in need of assistance for "names"!

9 years ago

I thought that is what the article said...*facepalm*...I'll just follow what you said. It seems easy enough. I feel pretty dumb right now XD

Newbie in need of assistance for "names"!

9 years ago

Yeah, sorry.

I developed the one page system and tried it out in a story before; personally, I think it keeps things nicer and neater than the system suggested in the article. If you need help or it doesn't work as intended, let me know and I'll try to troubleshoot.

Newbie in need of assistance for "names"!

9 years ago

Thanks a lot! I'll definitely let you know how it turns out!

Newbie in need of assistance for "names"!

9 years ago

You're welcome. I hope it helps.

Newbie in need of assistance for "names"!

9 years ago

Ok, I did everything you said and I tested it. Everything works, but now I need the code to show the name to the player. I tried using the code in the article but for some reason it didn't work. Is it the right code?

Newbie in need of assistance for "names"!

9 years ago

It should be. If you need to, you can temporarily add me as a co-author and I can double-check everything.

Newbie in need of assistance for "names"!

9 years ago

That would really help. Thanks.

Newbie in need of assistance for "names"!

9 years ago

Alright. Test it out.

Newbie in need of assistance for "names"!

9 years ago

Awesome dude! Thanks a lot!

Newbie in need of assistance for "names"!

9 years ago

You're welcome. Note that every time you want the name to appear you have to insert that huge block of %%STUFF%% into the page. I think I know a way to fix that, but allow me to test it out a little on my own story first.

Newbie in need of assistance for "names"!

9 years ago

Sure thing!

Newbie in need of assistance for "names"!

9 years ago

Hmm...my crazy idea probably won't work. Sorry to get your hopes up.

Newbie in need of assistance for "names"!

9 years ago

I have a way to fix it, but it involves JavaScript and the variables all need to be two-digit.

Newbie in need of assistance for "names"!

9 years ago

Do tell...

Newbie in need of assistance for "names"!

9 years ago

Here's the gist. First, and it might take some work, but make sure every %DIGIT variable defaults to -1, and instead of assigning the variables so that A=1, make A start at 10 (so, A=10, B=11, ..., Z=35). This ensures that the value of the variables will always be two characters long, and easier to work with.

Second, paste this code in the global page script:

$PAGETEXT := "<script type='text/javascript' src='../../Resources/jQuery/jquery-1.7.1.min.js'></script><script>$(function(){var e='" + %DIGIT1 + %DIGIT2 + %DIGIT3 + %DIGIT4 + %DIGIT5 + %DIGIT6 + %DIGIT7 + %DIGIT8 + "',n='';for(e=e.replace(/-1/g,''),k=0;k0?String.fromCharCode(55+parseInt(e.substr(k,2))).toLowerCase():String.fromCharCode(55+parseInt(e.substr(k,2)));document.body.innerHTML=document.body.innerHTML.replace(/:{2,}NAME:{2,}/g,n.toUpperCase()),document.body.innerHTML=document.body.innerHTML.replace(/:{2,}name:{2,}/gi,n)});</script>" + $PAGETEXT

This code sends the values of the variables to JavaScript, which converts them into letters, and replaces any instance of ::Name:: with the player's name (in addition, ::NAME:: makes it all-caps).

Newbie in need of assistance for "names"!

9 years ago

Damn, Brad, I feel just about worthless now. That's exactly what I was trying to do.

Newbie in need of assistance for "names"!

9 years ago

Well, to be fair, I did have eight months to more or less make the way it is now.

Newbie in need of assistance for "names"!

9 years ago

I'm unfamiliar with the external script you called. What does it do?

Newbie in need of assistance for "names"!

9 years ago

jQuery? It's a JS library. You can do a lot of document manipulation with it, but I only really used it for the $( document ).ready() function, which if I understand it correctly, allows the processing to be run earlier and hopefully prevent/lessen the unreplaced ::Name:: text's being visible.

Newbie in need of assistance for "names"!

9 years ago

Edit: Oh, well, damn.

Newbie in need of assistance for "names"!

9 years ago

It's pretty modifiable depending on how one wants to use it, so probably, but I think I may as well provide the basis for what I've been using.

Newbie in need of assistance for "names"!

9 years ago
Neither of our ways involved having a page for each letter of the alphabet.