If you're new to scripting, there is one major thing you need to keep in mind. It is better to use variables instead of definitive values. Let me explain:
NPC Code:
if (timeout)
{ if (keydown(0) && strequals(#s(client.string),1))
{ setstring client.string,2;}
if (keydown(0) && strequals(#s(client.string),2))
{ setstring client.string,3;}
if (keydown(0) && strequals(#s(client.string),3))
{ setstring client.string,4;}
if (keydown(0) && strequals(#s(client.string),4))
{ setstring client.string,1;}
timeout=0.1;
}
take THAT where you are setting it to a certain value, which makes editing a SUPER BISH or this:
NPC Code:
if (timeout)
{ if (keydown(0)
{ setstring client.string,#v(#s(client.string)+1);}
if (strtofloat(#s(client.string))=>5)
{ setstring client.string,1;}
timeout=0.1;
}
that makes it so that you have a LOT less coding, and can change things. I put that if the tsring is equal to OR GREAT THAN for a reason. If by some MISHAP or something you end up with 6 or something, then it wouldn't work. I try and build in 'extra protection' so incase something crazy happens and you have a glitch, it still works

And when you're doing things, and the same actions will be repeated by more than one event, I find it best to use functions. If you need help with strings and/or this.vars read
www.projectshifter.com more coming soon
---Shifter