EDIT: Chandler got to it before me and used the wonders of string/float nondiscrimination and multi-dimensional arrays in gs2 to his advantage
This isn't a long script because it's in GS1, it's just long because it's not coded efficiently.
Anyways, as said, <200=serverside, >=200=clientside.
And second, I really urge you to look into arrays and loops to optimize this script.
PHP Code:
//#CLIENTSIDE
function customize() {
setstring this.gui,toguilightest.png;
setstring this.text,
"Health: #s(clientr.player_hp)/#s(clientr.player_maxhp)",
"Mana: #s(clientr.player_mp)/#s(clientr.player_maxmp)",
"Type: #s(clientr.player_type)",
"#e(0,13,#n)#s(this.nick)",
"Talik: #v(player.rupees)",
"Shield: #v(playershieldpower)",
"Weapons: #s(this.enabweap)",
"Lvl. Type: #s(this.zonetype)";
// Display options for each text object
// x,y,red,blue,green,style options
// style options: 0=bold, 1=bold+italic, 2=bold+right
this.doptions={
32,64,1,0,0,0,
32,80,0,1,1,0,
32,96,1,1,1,0,
72,48,1,1,1,1,
280,48,0,1,0,2,
280,64,1,1,1,2,
280,80,1,1,1,2,
280,96,1,1,1,2,
};
}
if (created || timeout) {
customize();
this.img=200;
showimg this.img,#s(this.gui),16,16;
changeimgvis this.img,4;
this.img++;
showimg this.img,#3,32,32;
changeimgpart this.img,0,64,32,32;
changeimgvis this.img,4;
this.img++;
for (i=0;i<sarraylen(this.text);i++) {
tokenize b bi br;
setstring this.style,#t(this.doptions[5+i*6]);
showtext this.img+i,this.doptions[i*6],this.doptions[1+i*6],Arial,#s(this.style),#I(this.text,i);
changeimgcolors this.img+i,this.doptions[2+i*6],this.doptions[3+i*6],this.doptions[4+i*6],1;
changeimgzoom this.img+i,.6;
changeimgvis this.img+i,4;
this.img++;
}
if (weaponsenabled) setstring this.enabweap,Enabled;
else setstring this.enabweap,Disabled;
if (nopkzone) setstring this.zonetype,No PKing;
else {
if (issparringzone) setstring this.zonetype,Sparring;
else setstring this.zonetype,PKing;
}
showstats 1024;
timeout = 0.05;
}
I'll explain what I did with this. First, I have the string list at the top, each string contains what text you want to display(like you had one showimg for each text). Second I have the array. This is a little complicated, but I have it hold the options for each instance of text. We'll be able to access this in the loop to organize it.
Now I use the for loop to go through the information I need and display the text for each instance of text in the string list.
EDIT: forgot to explain the variable this.img.
this.img starts at 200(the index used to make the images clientside), and increases once for every time an image is show, therefor, all images are shown on their own unique index.
And looks like you've got three scripts to play with, aren't you the lucky one
