Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Scripting Guidance (https://forums.graalonline.com/forums/showthread.php?t=61880)

Mykel 10-23-2005 06:45 AM

Scripting Guidance
 
Okay, so I've recently taken up an interest in scripting. So far all I am doing is looking at scripts and trying to understand them, and then editing them in some other way to try new things. I could use your help some. If someone could please explain the following script in the most basic of terms possible, it'd be greatly appreciated.

NPC Code:
if (playerchats && strequals(#a,Mykel)) {
if (startswith(/skin,#c)) {
setcharprop #C0,#T(#e(6,-1,#c));
}
}


I understand the part about it having to be my account, and it starting with /skin and then the color, but I don't understand how the
NPC Code:
setcharprop #C0,#T(#e(6,-1,#c));

makes it all work. Thank you for your help.

LilNiglet 10-23-2005 07:11 AM

NPC Code:
setcharprop #C0,#T(#e(6,-1,#c));



setcharprop - sets THIS npc's property
#C0 - property for skin color
#T(string) - trims spaces off start and end of string, not needed here
#e(startindex,stopindex,string) - takes a slice of a string from startindex to stopindex. 6 is determined by counting characters (including spaces!), so it'd be / = 1, s = 2, k = 3, and so on. remember, spaces count. -1 means to not take a stopindex, but use the end of the string as the terminator. #c is the player's chat string.

SyLaTAC 11-03-2005 11:40 PM

wow...even that helped me thx :)

Lance 11-04-2005 02:31 AM

If you want that #T to work properly, the #e should start counting at position 5, not 6.

It starts from zero, Tupper.


All times are GMT +2. The time now is 06:10 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.