|
In the real world ogod.
|
 |
Join Date: Dec 2005
Location: Refugio, Texas
Posts: 435
|
|
Quote:
|
Originally Posted by Draenin
NPC Code:
//#CLIENTSIDE
function onPlayerchats(){
if (startswith(setbody,#c)) {
setplayerprop #8,#e(8,-1,#c);
}
if (startswith(sethead,#c)) {
setplayerprop #3,#e(8,-1,#c);
}
if (startswith(setshield,#c))
setplayerprop #2,#e(10,-1,#c);
}
if (startswith(setsword,#c)) {
setplayerprop #1,#e(9,-1,#c);
}
if (startswith(sethat,#c)) {
setplayerprop #P1,#e(7,-1,#c);
}
if (startswith(skin,#c)) {
setplayerprop #C0,#e(5,-1,#c);
}
if (startswith(coat,#c)) {
setplayerprop #C1,#e(5,-1,#c);
}
if (startswith(sleeves,#c)) {
setplayerprop #C2,#e(8,-1,#c);
}
if (startswith(shoes,#c)) {
setplayerprop #C3,#e(6,-1,#c);
}
if (startswith(belt,#c)) {
setplayerprop #C4,#e(5,-1,#c);
}
if (startswith(all,#c)) {
setplayerprop #C0,#e(4,-1,#c);
setplayerprop #C1,#e(4,-1,#c);
setplayerprop #C2,#e(4,-1,#c);
setplayerprop #C3,#e(4,-1,#c);
setplayerprop #C4,#e(4,-1,#c);
}
}
There. Should be a more useful formatting style, and it eliminates the unnecessary else cases. I'm not a fan of the #commands, but I still have to learn how those need to be written out in GS2.
|
GS2 does not work in the offline editor. Which is why I wrote it in GS1 to begin with.
NPC Code:
//#CLIENTSIDE
function onPlayerchats(){
if (player.chat.starts("setbody")) {
player.bodyimg = player.chat.substring(8,-1);
}else if (player.chat.starts("sethead")) {
player.headimg = player.chat.substring(8,-1);
}else if (player.chat.starts("setshield"))
player.shieldimg = player.chat.substring(10,-1);
}else if (player.chat.starts("setsword")) {
player.swordimg = player.chat.substring(9,-1);
}else if (player.chat.starts("sethat")) {
player.attr[1] = player.chat.substring(7,-1);
}else if (player.chat.starts("skin")) {
player.colors[0] = player.chat.substring(5,-1);
}else if (player.chat.starts("coat")) {
player.colors[1] = player.chat.substring(5,-1);
}else if (player.chat.starts("sleeves")) {
player.colors[2] = player.chat.substring(8,-1);
}else if (player.chat.starts("shoes")) {
player.colors[3] = player.chat.substring(6,-1);
}else if (player.chat.starts("belt")) {
player.colors[4] = player.chat.substring(5,-1);
}else if (player.chat.starts("all")) {
for (i=0;i<5;i++) {
player.colors[i] = player.chat.substring(4,-1);
}
}
}
This is the way it would look, though. Mixing GS1 and GS2 is bad, Draenin. |
__________________
Quote:
Originally Posted by Darlene159
I would rather have dead forums.
|
|
|