Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-14-2002, 11:25 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
New Scripters: Read!

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
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:06 AM.


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