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 07-14-2003, 07:58 PM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Question showimg error?

NPC Code:

function InitializeImageArrays()
{
this.imageCount = 3; // Change this accordingly
setarray this.imageShow, this.imageCount; // 1 = auto show, 0 = no auto show
setarray this.imageIndex, this.imageCount;
setarray this.imagePosX, this.imageCount;
setarray this.imagePosY, this.imageCount;
setarray this.imageStartX, this.imageCount;
setarray this.imageStaryY, this.imageCount;
setarray this.imageWidth, this.imageCount;
setarray this.imageHeight, this.imageCount;
setarray this.imageLayer, this.imageCount;

// The main image
this.imageShow[0] = 1;
this.imageIndex[0] = 1;
this.imagePosX[0] = 0;
this.imagePosY[0] = screenheight - 118;
this.imageStartX[0] = 0;
this.imageStartY[0] = 71;
this.imageWidth[0] = 487;
this.imageHeight[0] = 118;
this.imageLayer[0] = 5;

// The HP bar
this.imageShow[1] = 1;
this.imageIndex[1] = 2;
this.imagePosX[1] = 15;
this.imagePosY[1] = screenheight - 72;
this.imageStartX[1] = 10;
this.imageStartY[1] = 29;
this.imageWidth[1] = 5;
this.imageHeight[1] = 27;
this.imageLayer[1] = 4;
}

function ShowImages()
{
for ( i = 0; i != this.imageCount; i++ )
{
if (this.imageShow[i] == 1)
{
showimg this.imageIndex[i], gui1.gif, this.imagePosX[i], this.imagePosY[i];
changeimgpart this.imageIndex[i], this.imageStartX[i], this.imageStartY[i], this.imageWidth[i], this.imageHeight[i];
changeimgvis this.imageIndex[i], this.imageLayer[i];
}
}
}



Does anyone know why this wont work? Both of there function are called when the npc gets created. The InitializeImageArrays function is called first. Then the ShowImages function.

I I set the imageCount to 1 then it doesnt cause an error, but then that defeats the whole purpose of what I am trying to do.

If it is an error in my script I just can't see what it is. What I believe is it is an error with the showimg command placed in a 'for loop'. I am just not sure so if anyone who knows what the problem is would post an answer I would greatly appreciate it.
__________________
new account: Trevor
Reply With Quote
  #2  
Old 07-14-2003, 08:16 PM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
array elements aren't called using arrayname[elementnumber]

#I(arrayname,elementnumber)

(wrong language )
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #3  
Old 07-14-2003, 08:52 PM
Falados Falados is offline
Cucumber NPC
Falados's Avatar
Join Date: Jan 2003
Posts: 141
Falados is on a distinguished road
Send a message via ICQ to Falados Send a message via AIM to Falados
Quote:
Originally posted by Tseng
array elements aren't called using arrayname[elementnumber]

#I(arrayname,elementnumber)

(wrong language )
But these are REAL arrays, not string arrays.


Try a timeout loop.

and intalize the arrays when created & playerenters

thats all I can come up with at a glance. (you could also try using indicies of 200 or greater instead of 1 and 2, I duno if that would help, but it makes it clientside instead of showing it for all players)
__________________

subliminal message: 1+1=3
Reply With Quote
  #4  
Old 07-14-2003, 11:22 PM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Quote:
Originally posted by Tseng

array elements aren't called using arrayname[elementnumber]

#I(arrayname,elementnumber)

(wrong language )
Silly Tseng, I am using "setarray" not string arrays .

Quote:
Originally posted by Falados

But these are REAL arrays, not string arrays.


Try a timeout loop.

and intalize the arrays when created & playerenters

thats all I can come up with at a glance. (you could also try using indicies of 200 or greater instead of 1 and 2, I duno if that would help, but it makes it clientside instead of showing it for all players)
I'll try that out and report back.

I didn't know indicies of 1 and 2 were clientside >.< .
__________________
new account: Trevor
Reply With Quote
  #5  
Old 07-14-2003, 11:52 PM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Note to self: Don't post in the NPC Scripting forum 10 minutes after I wake up, my brain isn't awake yet.

(Wow, do I feel stupid.)
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #6  
Old 07-15-2003, 12:15 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Quote:
Originally posted by Tseng
Note to self: Don't post in the NPC Scripting forum 10 minutes after I wake up, my brain isn't awake yet.
You sure sleep late .


Quote:

(Wow, do I feel stupid.)
You should :grin: .
__________________
new account: Trevor
Reply With Quote
  #7  
Old 07-15-2003, 02:47 AM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by tlf288


You sure sleep late .

10 AM, pacific standard time, is late?
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #8  
Old 07-15-2003, 03:08 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
No.... I sometimes don't take account for timezones.
__________________
new account: Trevor
Reply With Quote
  #9  
Old 07-15-2003, 06:16 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Boil the problem down to the necessities if you want somebody to look at it.
__________________
Reply With Quote
  #10  
Old 07-15-2003, 07:00 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
I did. Those are the two functions I came down to. Then I removed all other set of arrays in the InitializeImageArrays besides two because it will work with one set, but starts to have problems with more than one.
__________________
new account: Trevor
Reply With Quote
  #11  
Old 07-15-2003, 07:13 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by tlf288
I did. Those are the two functions I came down to. Then I removed all other set of arrays in the InitializeImageArrays besides two because it will work with one set, but starts to have problems with more than one.
And you really think all those fields are necessary? ImageLayer? ImageStartX? You should delete everything you can remove without stopping the error from occuring and, when the removal of an element does negate the error, it's a big clue as to what is wrong.

Also: 'It doesn't work' is not an error. Tell us what it does, what it doesn't do, what it's supposed to do.
__________________
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 08:19 PM.


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