Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

string and number question

clark

Villager
Xy$
0.00
so say i made a variable... like this

var x = 'choice' + 4 + 2

it would return choice42 correct? or would it be choice6
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
It will return choice42, I'm pretty sure you would add parenthesis to add the numbers together. so
JavaScript:
var x = 'choice' + (4+2);
 

clark

Villager
Xy$
0.00
i didnt need it to. im just at work so i couldnt test it. im adding a variable into a choice picture script to add flexibility and wondering if i could just slam a variable in before the end of the filename identifier for the pic. sounds like itll work great
 

clark

Villager
Xy$
0.00
what i actually did was modify a script that if a switch was on, it displayed pictures with filenames choice1, 2, 3 etc to contain a variable, so now instead of choice+index its choice+gamevariable+index, allowing me to use it in many more ways. just adding that allowed it to be character creation, fast travel, arena, etc. in combo with tsukihimes hidden choices and conditional choices it may serve for even more.
 
Top