Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-01-2009, 07:42 PM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
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?
Reply With Quote
  #2  
Old 09-01-2009, 08:04 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #3  
Old 09-01-2009, 08:42 PM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
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.
Reply With Quote
  #4  
Old 09-01-2009, 08:43 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #5  
Old 09-01-2009, 11:56 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Just do
PHP Code:
for (i=05; ++i
so it replaces any text that shouldn't be displayed anymore.
__________________
Do it with a DON!
Reply With Quote
  #6  
Old 09-02-2009, 10:11 PM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
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++;
      } 
Reply With Quote
  #7  
Old 09-03-2009, 01:00 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
thiso.testmsg should be this.testmsg.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 11:02 AM.


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