Problems with questlog GUI (SOLVED)

Started by s0cket, Wed 10/03/2010 16:53:32

Previous topic - Next topic

s0cket

So,I want to create GUI witch will display tasks that player need to do.I use listbox for displaying titles of the quest.When player recieves the quest,entry in that listbox appears containing title of quest that has been recieved.I also want to update those titles when quest is completed.
For description of the quest(what is requirements and so on) I use label in another GUI.I need this label to be updated when player clicks on quest title(see "way to update the text of description").
On the main gui is the button "description" witch will show the description gui,and quest information that has been selected in the listbox should be displayed there.Sorry if this looks very messed up :/.


way to update the text of description(witch is even harder to me to understand)

when player clicks the quest title in questlist, INT that handles current selection of quest title updates(but listboxes have selected item int in themselves,don't they ?)anyway...When player clicks "description" button it will collect information of selection INT and it will make me write a lot of if's(but I don't mind if it's the easy way)

e.g.

Code: ags
if (int_that_handles_selection_in_listbox == 1) 
  {
   lblDescription.Text = ("you have to find the socks!open your eyes and look");
  }

if (int_that_handles_selection_in_listbox == 2)
  {
   lblDescription.Text = ("you have to buy milk.it will make your bones and teeth strong");
  }


and so on...


But the problem is,I don't even know how fo formulate this in human language(as you can see :) ) and doing the scripting in AGS- oh my :( .So if anyone understands and can help me with this and WILL help me-be sure you will be mentioned in my upcomming game credits :).thank you for your time.(Also sorry if I'm double-posting.I have moved to UK recently,only internet connection for now costs me 1£/hour so I don't have mutch time to search for things like that.)


Version of AGS I use for scripting: 3.1.2 SP1

Khris

You need ListBox.SelectedIndex:

Code: ags
// click on description button

function description_OnClick(...) {

  String d[50];

  d[0] = "You have to find the socks! Open your eyes and look.";
  d[1] = "You have to buy milk. It will make your bones and teeth strong.";
  d[2] = "..."
  ...

  lblDescription.Text = d[LISTBOXNAME.SelectedIndex];
}


Keep in mind that for arrays and listboxes, the first item has index 0.

s0cket

#2
So I finally figured it all.And thanks to Khris for telling about arrays.
Actually I knew how to do it(yeah right ;) ),but my problem was that I couldn't arrange everything(where to put stuff in scripts, how to formulate this and that) but thanks to AMAZING tool I found in (surprisingly) Fl Studio and burning ~million brain cells I DID IT RIGHT :).It is called synthmaker,so it means you can create your own synthezer for your tracks.But I used it to display graphical version of my code(what stuff does what and so on).God, I wish every programming language in future would be as simple and powerfull as this tool :).Anyways here is a screen for you to see how I did it and how powerfull it is :D :

http://www.ipix.lt/images/54343522.png

if you want the plugin(for Fl studio,not ags) PM me.

SMF spam blocked by CleanTalk