Instalează Steam
conectare
|
limbă
简体中文 (chineză simplificată)
繁體中文 (chineză tradițională)
日本語 (japoneză)
한국어 (coreeană)
ไทย (thailandeză)
български (bulgară)
Čeština (cehă)
Dansk (daneză)
Deutsch (germană)
English (engleză)
Español - España (spaniolă - Spania)
Español - Latinoamérica (spaniolă - America Latină)
Ελληνικά (greacă)
Français (franceză)
Italiano (italiană)
Bahasa Indonesia (indoneziană)
Magyar (maghiară)
Nederlands (neerlandeză)
Norsk (norvegiană)
Polski (poloneză)
Português (portugheză - Portugalia)
Português - Brasil (portugheză - Brazilia)
Русский (rusă)
Suomi (finlandeză)
Svenska (suedeză)
Türkçe (turcă)
Tiếng Việt (vietnameză)
Українська (ucraineană)
Raportează o problemă de traducere
Yes. An array can contain strings and vars. It's just a set of data.
There's a number of ways to do it, but the MATH function seems to be your best answer.
Check out the answers to this question on StackOverflow.
http://stackoverflow.com/questions/1379553/how-might-i-find-the-largest-number-contained-in-a-javascript-array
I was wondering whether you knew how someone would go about writing code to find the highest score in a set of variables. In my example, the main character is rescued by the character who has the highest relationship with them at the time the scene plays.
Is it possible to write something that would compare all six of the bachelors' affection scores and find who has the highest and then jump to their rescue scene? My friend suggested making an array, but can arrays include variables?
While not a bad idea, that's out of the scope of this tutorial, and definitely much more complex! It To make a "Princess Maker" or "Tokimeki" type sim game, you would need to create a set of variables for keeping track of the date, as well as figure out a "routine" set of commands that the player would continuously loop through. Through out you would set prompts for it to check things that would break it out of the loop. Such as "Is today a special date?" etc. If so run a subroutine, then have it jump back in to the loop.
This tutorial should actually contain most everything you need already, it's just a matter of practical application. You may wish to learn the fundamentals of game programming if you're stumped. There's some free classes on JavaScript at EDX.org I think, and Udemy.
tyranoscript_wiki
https://translate.google.co.jp/translate?hl=ja&sl=ja&tl=en&u=http%3A%2F%2Ftyrano.wiki.fc2.com%2F
(for example, Long Live the Queen lasts 40 in-game weeks that function as turns for the player. In Princess Maker, you spend 1 month incraments raising your daughter that add up to a total of 8 years)
I suppose if you wanted to assign a random number to something within the array you could have initial set nulls then say something like...
f.Yuko[2] == (random number code);
The point of an array is clean code. So you don't have to create a ton of separate variables; instead you can assign a ton of values to 1 variable. This is an important concept of "object oriented programming." Treating Variables like objects.
Think back to Geometry. To get volume you times Length x Width x H. Those all belong to the BOX. The box is its own variable. Creating an array essentially makes it its own class or object.
f.BOX == [L, W, H];
The Box's Volume would equal f.BOX[0] * f.BOX[1] * f.BOX[2]
So your variable name would be say the name of your character (The var name is symbolic)
So to set Yuko's Name, Favorite Color, and Age you'd do as follows:
[f.Yuko = ["Yuko","Blue", 18]];
As for the Variable manager...as far as I can tell that is TyranoBuilder simplifying TyranoScript for you and not inherent to TyranScript itself. You have more flexibility learning code than you do using the Automation functions here. It's still worth using TyranoBuilder tho as it still greatly simplifies development.
Just FYI it'd be random using
[eval exp="f.RandomOption=Math.floor((Math.random() * 6 ) +1) "]
[if exp="f.RandomOption == 1"]
Hence why I want more variables for the one character.
But then doesn't it leave you ending up creating dozens of the variables in the variable manager, or is that the point of the manager?
[emb exp=f.Character1] = Name
[emb exp=sf.Character1] = Age
Then what?
Would I need to create a new variable in the manager called Character1_B and then do
[emb exp=f.Character1B] = Fave Colour
[emb exp=sf.Character1B] = Dosh
So if character is selected it would go something like...
This is [emb exp=f.Character1]
[emb exp=f.Character1] is [emb exp=sf.Character1] years old.
[emb exp=f.Character1]'s favourite colour is [emb exp=f.Character1B]
Currently, [emb exp=f.Character1] earns [emb exp=sf.Character1B] per turn.