Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Help with displaying.. (https://forums.graalonline.com/forums/showthread.php?t=87723)

Sage_Shadowbane 09-01-2009 07:42 PM

Help with displaying..
 
Ok, I was just wondering if anyone could explain and show examples of how exactly to display x ammt of variables in an array, and than be able to scroll through the rest of the variables in the array. Eg: this.array = {1, 2, 3, 4, 5, 6}; I want to do a text showing of the first 1, 2, 3, 4, 5, have the 6 hide, than when I click a button the text will display, 2, 3, 4, 5, 6 (scrolling downwards). Can someone help me please?

DustyPorViva 09-01-2009 08:04 PM

PHP Code:

this.scrollto 0;
for (
temp.this.scrollto;i<this.scrollto+5;i++) {
  
showtext(200+i,........,this.array[i]);
}
this.scrollto this.scrollto&#37;this.array.size()-5; 

Increasing this.scrollto will move the displayed array to the next value.
this.scrollto = this.scrollto%this.array.size()-5; will roll it back to 0 if you increase it to much. From there, you simply add in whatever keyboard or mouse controls to increase this.scrollto.

Alternatively, you can also simply display ALL of the data in a scroll GUI, and manipulate that.

Sage_Shadowbane 09-01-2009 08:42 PM

I've done this before, and it displays 1, 2, 3, 4, 5. Than I increase the scrolling variable and its displays 1, 2, 3, 4, 5, 6. When what I want it to display is 2, 3, 4, 5, 6. (Hiding the 1). The thing is I'm not sure of is how to hide the 1.

DustyPorViva 09-01-2009 08:43 PM

Ahh... Try this instead:
PHP Code:

this.scrollto 0;
for (
temp.this.scrollto;i<this.scrollto+5;i++) {
  
showtext(200+i-this.scrollto,........,this.array[i]);
}
this.scrollto this.scrollto%this.array.size()-5

Problem is the showimgs from previous numbers are sticking around as they're not being hidden after used. That should subtract the offset so it will always display with an index of 200-205.

You can also simply detect when there is a change in what's being hidden(this.scrollto changing) and hide all the images before you display them again. The next loop will refresh them, therefor hiding all the unused and showing the current properly.

zokemon 09-01-2009 11:56 PM

Just do
PHP Code:

for (i=05; ++i

so it replaces any text that shouldn't be displayed anymore.

Sage_Shadowbane 09-02-2009 10:11 PM

Okay I've figured out the scrolling thing thanks to Dusty and little help from Chompy. Now I've got another question relating to wraptext(), I can't seem to figure out how to get this to work at all. Chompy tried to give me a solution using wraptext2() but it didn't work at all so I came up with my own way which is working a little better than Chompy's but still isn't working, Would anyone mind pointing out the problem and explaining what's wrong with it?

PHP Code:

    this.testmsg "Testing 1 2 3 Testing 1 2 3 Testing 1 2 3 Testing 1 2 3 Testing 1 2 3 Testing 1 2 3 Testing 1 2 3 Testing 1 2 3 Testing 1 2 3 Testing 1 2 3";
    for(
temp.j:wraptext(56" "thiso.testmsg)) {
      
with (findImg(450 ind)) {
  
        
text j;
        
font "Arial";
        
style "bi";
        
zoom 0.6;
        
red green blue 1;
        
alpha .6;
        
textshadow true;
        
shadowcolor = {010};
        
layer 5;
        
thiso.sStartpos[0] + 57;
        
thiso.sStartpos[1] + 151 + (ind 14);
      }
      if (
ind 7) {
    
        
ind++;
      } 


Stryke 09-03-2009 01:00 PM

thiso.testmsg should be this.testmsg.


All times are GMT +2. The time now is 10:12 AM.

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