jon jon - 1 year ago 95
Java Question

Increase nominal value of a text insid variable?

How I can increase this text value inside my variable ?

For example, a file name inside the folder

fileNAME = '1';

Later in the script I need to do a variable have a number and need to set this number to the fileNAME:


and need to set to newNumber value:

fileNAME = '*newNumber*';

Here what am not sure how to do this.

Here the full script

// Listing item menu
// Listi= test premiere list
Itemlist = 1; // test itemid 1 in DB
Listi=1; // List loop (while) Listi/ max item show in screen
Pid = 100; // Picture id (100-1 eatch loop)
Xitem = 0; // X coor for the item + picturesize+ marge
Yitem = 0; // Y coor for the item + picturesize+ marge
InpicX = 46; // Initial X of menue item list
InpicY = 186; // Initial Y of menue item list
MargeX = 7; // Marge bettwenn 2 picture X
MargeY = 6; // Marge bettwenn 2 picture Y
ISIZEX = 82; // X size of picture
ISIZEY = 82; // X size of picture
fileNAME = '1';// identifie le nom fichier 1,2,3,4,5,6 .....
PIDNAME = 0 // identifie le nom de limage a id de limage
// Test if have item
if (($gameParty.hasItem($dataItems[Itemlist])==true || $dataItems[Itemlist].itypeId !== 2) || $dataItems[Itemlist].itypeId !== 3){
$gameScreen.showPicture(Pid, fileNAME, 0, InpicX+Xitem, InpicY+Yitem, 100, 100, 255, 0);
$gameScreen.setPictureCallCommon(Pid, 21, 1);
// cré une variable PIDNAME [X] selon le pid ex: si clic sur image 200 , variable volatile PIDNAME= LE NOM DE FICHIER
PIDNAME[Pid] = $gameScreen._pictures[Pid]._name;
if (Listi==12 || Listi==24 || Listi==36) {
Xitem=0; Yitem+=ISIZEY+MargeY; Itemlist++; Listi++; Pid++;
}else{Xitem+=ISIZEX+MargeX; Itemlist++; Listi++; Pid++;}
}else {Itemlist++;}}

Answer Source

Convert your file name to an int.


Then increment the number.


Finally, convert the file number to a string and use it for your purpose.


Or More easily

Keep a variable to track your current file number.


Increment it whenever you want to.


Then convert that to string to get the string representation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download