Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-10-2001, 11:51 PM
Skatche Skatche is offline
Registered User
Join Date: Aug 2001
Location: Gehennom
Posts: 353
Skatche is on a distinguished road
Send a message via AIM to Skatche
Arrays of strings!

Pleasepleaseplease Stefan... as someone who's first language was C++, I can safely say that I cannot live much longer (nor can I make cool book NPCs) without the aid of arrays of strings. Oh, and are multidimensional arrays possible? If not, add those too. And multidimensional arrays of strings! And, and, and this.strings (is this possible with an NPC server? I know this.flags are...)
__________________
Skatche, head priest of the Cult of Duckduck.
Praise Duckduck!
Reply With Quote
  #2  
Old 08-11-2001, 02:42 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Clever people find ways around.

setstring oldx0,#v(playerx);
for(this.i=1;this.i<5;this.i++) setstring oldx#v(this.i),#v(strtofloat(#s(oldx#v(this.i-1))));
will create an "array" of 5 strings, oldx0, oldx1, oldx2 oldx3, oldx4

multidimentional strings are noticably easier than multidimentional variables:
setstring oldx0-0,#v(playerx),#v(playery);
for(this.i=1;this.i<5;this.i++){
for(this.n=1;this.n<5;this.n++){
setstring oldx#v(this.i) #v(this.n),#v(strtofloat(#s(oldx#v(this.i-1)-#v(this.n-1)
)));
}
}
will create an "array" of 25 strings, oldx0-0, oldx0-1, oldx0-2 oldx0-3, oldx0-4...
I botched the creation a little, you'd need to set the column oldx0-n and the row oldxn-0 for that snippet to work, but you get the idea.

this.strings are kinda tricky, but if you only need one, and the NPC doesn't have any showimgs(this version NPCs have to show to show images, and drawunderplayer NPCs make drawunderplayer images, it's weird), and it doesn't have to be visible, just use setcharprop #n,string; !
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #3  
Old 08-12-2001, 09:46 AM
Skatche Skatche is offline
Registered User
Join Date: Aug 2001
Location: Gehennom
Posts: 353
Skatche is on a distinguished road
Send a message via AIM to Skatche
oh dear god! I knew Graalscript was teaching me bad programming habits... but being able to fill in part of variable names using a message code is just wrong! Anyway, thanks for your code snippets. It just feels wrong to do stuff like that... but what the hey.
__________________
Skatche, head priest of the Cult of Duckduck.
Praise Duckduck!
Reply With Quote
Reply


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 09:05 AM.


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