Author Topic: Having a problem getting "List" to scroll past blank space  (Read 430 times)

icey games

  • It's the time of ICEY!!!


Hey'a guys, I had a question that I felt like reaching out to ask about good way to solve this here problem that's killing me internally right now.
I just wanna say that I'm still rocking AGS 3.3 and I haven't moved on to the latest version out of fear of something breaking. If that really isn't anything to worry about then just say the word and I'll move on. I'm also saying that because maybe in the latest version, what I'm seeking might be fixed in there list wise.

Anyhow, I have a few list to keep track of certain things in game like monster info, items, and other stuff. My problem that I'm just now discovering is that AGS wont scroll over or even past a blank space in a list. It stop right before it. I've even tried to use tweens to help but the same results happen.
Code: Adventure Game Studio
  1. function Button140_OnClick(GUIControl *control, MouseButton button)
  2. {
  3. if(List_History.Visible == true){
  4.   List_History.ScrollDown();
  5. }
  6. else if(List_Story.Visible == true){
  7.   List_Story.ScrollDown();
  8. }
  9. else if(List_Bios.Visible == true){
  10.   List_Bios.ScrollDown();
  11. }  
  12. else if(List_Other.Visible == true){
  13.   List_Other.ScrollDown();
  14. }  
  15. else if(List_Bestiary.Visible == true){
  16.    
  17.   List_Bestiary.TweenSelectedIndex(0.1, List_Bestiary.SelectedIndex+1, eEaseLinearTween, eNoBlockTween);
  18.   //List_Bestiary.ScrollDown();
  19. }  
  20. }
  21.  

Now something else to note is that the banner with the monster changes to the appropriate monster whenever you select the respective index. So I've placed monster 23 at index 23. My solution to this was to fill up the list with rows of "???" that would later be replaced with the actual monster name when you encounter them. Now the problem here is there is (that I no of) a way to check a the string of an index because if it was possible to do that I could just call an if statement to check the indextext to make it fire off what I need but I just cant do that.

Is there a proper solution to this or is this just an oversight in AGS that hasn't been address cut the entire documents section out of my game? I have only one other alternative to keeping it in game wise but I feel like there is a simple solution to making it where players dont have to collect books that unlock the tab that contains all that information instead of just finding all the info bit by bit...

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
I cannot reproduce this; adding empty strings to a listbox makes absolute no difference for me when it comes to scrolling.
As for getting the text, there's ListBox.Items[index]

However, the proper way to implement this is to store the monsters and their status in a struct array, then update the Listbox according to changes (monster is discovered -> monster[23].discovered = true; UpdateMonsterList(); )

One should never rely on a list item's text and string comparisons when the clicked index is not only available but also guaranteed to be unique and unchanged by translations or the like.
Grabbing the string instead is the programming equivalent of printing and re-scanning a digital image in order to email it as PDF instead of simply attaching the JPG to the email.

icey games

  • It's the time of ICEY!!!
Oh the reading of the text in a list selection was my work around for AGS not skipping over blank spaces. If it were to read the text "???" Then it wiould result in a "entry not found" banner but if it said something like "monster" then it would give an image with the connected monster banner.

But I've never seen that [index] option. I even looked in the manual so I assume that's just something more advanced.

As for using structs and arrays yeah that's something I still didn't fully learn as bad as that may sound. But I do understand your example, I just don't know how to properly set up the stuff for calling haha. If anything I know a guy that can probably help with that. Thanks for the help though, Khris.

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
Listbox.Items is right there in the manual. It's an array, and it can be used to read or change the listbox strings.

Code: Adventure Game Studio
  1.   // read first item
  2.   String first = myListBox.Items[0];
  3.  
  4.   // change 3rd item
  5.   myListBox.Items[2] = "Third item";
  6.  
  7.   // read currently selected item
  8.   String selection = myListBox.Items[myListBox.SelectedIndex];

Needless to say, all of this is explained in the manual.

icey games

  • It's the time of ICEY!!!
The [index] part I never seen I said. There's a chance that I also skipped over items itself looking for another name itself. But thanks though for the example given.

Also items isn't exactly the most clearest thing that refers to text itself when looking at the options for list box when just about everything else that points to text is simple .text. Items is such a vague name I would have never thought to utilize it unless you had mentioned it.
« Last Edit: 05 Feb 2018, 19:15 by icey games »

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
I don't know why I even bother. I should know better by now.

icey games

  • It's the time of ICEY!!!
What? What did I honestly say that was wrong? Sure it's the best to assume but I was going nuts looking for one simple thing for the list that isn't exactly as clear as everything else in AGS GUI-wise. Everything that I use that points to text says .text. Then we have...items. Not even Item, it's item s with and s. I looked through the manual to find out if what I was looking for was there in some way and it did not occur to me to check the one function that has such an arbitrary name. I was never a pro when it came to coding in AGS and I've always tried my best which is why I've gotten as far as I have and everything works like I want it to but sometimes I'll encounter something that may be very simple to someone pro like you like but is still complicated for me. I don't like having a hard time with you all the time, but I take it because the help is...well, helpful!

Besides, I wasn't taking shots at you. That was more so at whoever thought of that drifting away from an already working naming convention was for the best for that one thing.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
To be fair, "Items" is not an arbitrary name. The concept of the List is that it holds items inside, hence the property name. Everything in ListBox is called "items": you are adding strings there with "AddItem" function, and remove them with "RemoveItem". The total number of strings is retrieved with ItemCount property.
If you read through the "ListBox" section of the manual, word "item" and "items" is there everywhere.

My biggest recommendation for any case when you are working with some kind of object, like ListBox in this situation: take time to read through whole section in the manual about it, to know what functions it provides. Even if you do not need them right now, this way your memory may hint you what to look for later when you suddenly need to do a new thing with it.

« Last Edit: 05 Feb 2018, 20:40 by Crimson Wizard »

icey games

  • It's the time of ICEY!!!
That's fair. I guess I was looking at it in the a different light and when you mention remove item and add item it should have occurred to me that items might have been some use under further inspection but I was dead set on looking something related to text I didn't even think items would be just that.
I knew how everything else in the listbox worked for what I ever needed it for but this one thing was new to me so I didn't even process the thought.

On the contrary, however, it could have still be called ItemText since what it seems to be looking for is the text itself for the selected item in【#】 space but this has probably just been a function that's been there for ages now so I mean I wouldn't expect for it to be dumb down just because if the manual points it out.
« Last Edit: 05 Feb 2018, 20:45 by icey games »

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
The reason why I posted "I should know better by now" (and apparently still don't) is that for some reason you absolutely, positively cannot take even the most friendly RTFM without getting incredibly defensive about it and writing 200 words about how the manual has failed you, and making a string of pathetic excuses.

dayowlron

  • been programming computers since 1981
    • I can help with AGS tutoring
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
Well it is not called ItemText because it can contain more than just Text. This usage in AGS probably comes from the same thing as listboxes in other languages where the listbox items also consist of a numeric ID that can be used for identifying the Item. Strangely enough this numeric property is typically called ItemData.
Pro is the opposite of Con
This fact can clearly be seen,
If progress means to move forward
Then what does congress mean?  --Nipsey Russell

icey games

  • It's the time of ICEY!!!
Khris you're the one making it seem like I'm taking it personal. I ask monkey for help you think he throws in face manual this manual that? Come on I admitted I even tried looking in the manual but I didn't register that item was the key to what I was looking for. I didn't read over all the text in the manual to really latch on to the fact that item was a consistent word that was said throughout the list of section. All I said was tried looking for something "text" related and I didn't see it. Maybe I should have typed listbox text? I don't know. Like you're making seem like I was trying to take shots at you when that was never the case.

@dayowiron yeah after working it out I did catch on to that. All in all, what is there has been then for years because it works. I'm not doubting that, I'm just saying it's something I've never had to use in all my years of ags so when trying to work with it I was completely lost because what i thought would be there was worded as something else. But it's fine.

It's all working and I'm good to go.

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
You don't get it, and you never will.

icey games

  • It's the time of ICEY!!!
I guess I wont then and that's fine. I've gotten this far, haven't I? Regardless of how, my only goal is to finish this game as stable, playable, enjoyable as I possibly can. And I intend to do so. Whether you want to help me or not if I post here again then that is fine. Just know I appreciate the help regardless.