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
  #6  
Old 01-29-2002, 08:02 PM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
second edition

to set a string you would use the command setstring stringname,strings; lets say you want to set the string stringname with the value of 1, stringies, and 34kald, then you would do: setstring stringname,1,stringies,34kald :o

Arrays

Plain arrays are only numeric

you can initialize arrays two ways:
setarray arrayname,length;
arrayname={values,...}

you can change array variables many ways, but the most common (for me) is with arrayname[index]=newvalue;
so lets say you want a array of 4 different values and then set them to the current npcs hearts/mp/ap/direction, you would do the following;
setarray this.myvars,4;
this.myvars[0]=hearts; // Index 0 will be NPCs heart count
this.myvars[1]=mp; // Index 1 will be NPCs MP amount
this.myvars[2]=ap; // Index 2 will be NPCs AP amount
this.myvars[3]=dir; // Index 3 will be NPCs direction

you read values from arrays with arrayname[index], lets say you want the NPC to display his mp,direction,ap, and heart count, so you would:
message MP: #v(this.myvars[1]) Direction: #v(this.myvars[3]) AP: #v(this.myvars[2]) Hearts: #v(this.myvars[0]);

there are some other "commands" that help you find the length or arrays and stuff such as that

arraylen(arrayname); // For arrays
sarraylen(arrayname); // For string arrays

so, if you want to get the length of this.myvars from above, you would do
this.arraylength=arraylen(this.myvars);
this.arraylength is now equal to 4

if you want to find out the length of the above string, 'stringname', you would do
howlong=sarraylen(stringname);
no 'howlong' is equal 3
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
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 02:35 AM.


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