Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-03-2002, 01:34 AM
zallus-k zallus-k is offline
Registered User
Join Date: Sep 2001
Location: AC0265, Zaroke
Posts: 122
zallus-k is on a distinguished road
Dumb array question

I'm trying to script a system to create, display, and destroy "message box" type widows on the screen. The only thing is, I need to address each box as an individual object containing an x,y position. Now, how do I do this without using a multi-dimensional array?
__________________

Solemn Destiny - Owner
Reply With Quote
  #2  
Old 06-03-2002, 05:42 PM
Spanko Spanko is offline
Squeaker of Soles
Spanko's Avatar
Join Date: Nov 2001
Location: The Netherworl...lands
Posts: 1,366
Spanko is on a distinguished road
Send a message via ICQ to Spanko Send a message via AIM to Spanko Send a message via Yahoo to Spanko
You could sort of recreate a multi-dimensional array in one array, you just need to make the array twice as big as usual, and use some extra calculation while accesing it to seperate the x and y values.

a+b*c is the key.
__________________

ICQ: 125283920
MSN: [email protected]
AIM: Squeax0r
Squeaker seems unable to access the forum using this account.. tis a sad day.
Now with occasional Asuka flavour! Ooops a bit too much...
Asuka should be king of Dustari!

"Y'know, some days even my lucky rocketship underpants don't even help."
Reply With Quote
  #3  
Old 06-04-2002, 12:05 AM
Bhala Bhala is offline
Disgruntled Monkey
Bhala's Avatar
Join Date: Mar 2001
Posts: 779
Bhala is on a distinguished road
what i do when i use 1 array for things like x & y you can ether put them side by side or at equal lenghts apart.... {x, y, x, y } {x, x, y, y,}

with the first one to acess the x & y its index = x & index +1=y

the second is index=x index+(lenght of first part of array)=y
__________________
Reply With Quote
  #4  
Old 06-04-2002, 03:32 AM
BBflat BBflat is offline
Registered User
BBflat's Avatar
Join Date: Apr 2002
Location: United States of America
Posts: 573
BBflat is on a distinguished road
I just do what Graal does offline in the tile selection window thing. Take this matrix, for example...
NPC Code:

0 1 2 3 4

0 0 1 2 3 4
1 5 6 7 8 9
2 10 11 12 13 14
3 15 16 17 18 19


Those can be all the indexes, and you can treat them exactly like x,y coordinates. Just do row * 5 + column to get a specific index (start counting at 0).
Reply With Quote
  #5  
Old 06-04-2002, 09:11 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
NPC Code:

setarray XY,lenght; // define array
for ( i = 0 ; i < lenght * 2 ; i += 2){ // for loop with step of 2
XY[i + 0] = Whatever; // x value
XY[i + 1] = Whatever; // y value
}

// You could easily add as many variables as you like to an array this way.




This is basically how I do it.

I been using arrays for a long time. This works.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
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:28 PM.


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