Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Jono

#2
I have two functions called AddReminder and LoseReminder. I want to use them in room scripts as well as the global script. I have exported them at the end of the global script, and imported them into the global header. However, when I try to use LoseReminder in the middle of a function in my room script, it comes back with a parse error.

I've used it within the function hDoor_Interact() as follows:

Code: ags


LoseReminder("Phone Mum.");

#3
Ah. I should've noticed that. Thanks everyone who posted for your help and patience.
#4
It seems to be compiling fine now, thankyou.

Now I'm trying to get  the code working in game. I have the listbox lstJournal on the GUI gReminder.

I figured I could just set gReminder to visible when the function iJournal_Look() is run.

However, I get a "parse error" at "gReminder."

Here's the code I'm using for that.

Code: ags


function_iJournal_Look() {
gReminder.Visible == true;
}



Am I doing something wrong without realising it?
#5
I've been playing with this code some more and reading up on arrays and such. It still doesn't make complete sense to me.

This is the exact code I'm using at present

Code: ags

function AddReminder(String text) { 
  if (text == reminder[13]) {
  lstJournal.InsertItemAt(0, text); }
}

function LoseReminder(String text) {
  int Temp;
  while (Temp < lstJournal.ItemCount) {
    if (lstJournal.Items == reminder[13]) { // <------------- error here
      lstJournal.RemoveItem(Temp);
      Temp = lstJournal.ItemCount;
    }
  Temp ++;
  }
}


I think I'm supposed to create an array called "reminder". Is that correct?

This array would have fourteen different strings. I read a beginner's guide to arrays that said I would have to declare them in the global script file within game_start. I do this like so:

Code: ags


reminder[0] = "Go talk to police.";
reminder[1] = "Go to Hall's Garage.";

and so on. This works ok, the code compiles fine until the point marked above. The error says "expected array index after Listbox::Items". I thought that was an array index that I put after that part.

I've been busting my head trying to make sense of this alone  for days. If someone could help me understand what I'm supposed to be doing it would be greatly appreciated.
#6
I tried your example code, but it came back with the error "undefined token "txtWidth"".

Ah, wait. You said it doesn't work anyway.

Well back to Ashen's suggestion:

Code: ags
 
function AddReminder(String text) { // <------ this is where the error comes up.
  lstMemo.InsertItemAt(0,text);
}

function LoseReminder(String text) {
  int Temp;
  while (Temp < lstMemo.ItemCount) {
    if (lstMemo.Items == text) {
      lstMemo.RemoveItem(Temp);
      Temp = lstMemo.ItemCount;
    }
  Temp ++;
  }
} 


The error is that AGS says "text" is an undefined symbol. Am I supposed to define it somewhere and somehow?
#7
Ok, but when I try to run the script, it comes up with an error saying "undefined symbol 'text'".

Am I supposed to put something else in the place of "text", or define it elsewhere? If so what and how?

Surely I wouldn't put in a specific example of reminder text in to the function? I assumed it would work by me replacing "text" with the reminder text whenever I ran the function in scripting.  However, AGS doesn't seem to like the term "text".

Perhaps I'm just very, very confused.
#8
Hi, I'm making my first game in AGS, and I want to put in a feature which can allow the player to review objectives.
This would be done with a "notebook" inventory item, which when looked at brings up a GUI displaying the objectives that haven't been completed yet. Because the game isn't completely linear, I can't have each new objective taking the place of the last.

I did have a search around the forums for similar threads and found one from a while back: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=31624.0

I don't know it was ever solved. The last post was by Ashen, who suggested an untested piece of code:

function AddReminder(String text) {
  lstMemo.InsertItemAt(0,text);
}

function LoseReminder(String text) {
  int Temp;
  while (Temp < lstMemo.ItemCount) {
    if (lstMemo.Items == text) {
      lstMemo.RemoveItem(Temp);
      Temp = lstMemo.ItemCount;
    }
  Temp ++;
  }
}

The description sounded perfect for what I want to do, which is to have a ListBox within a GUI that displays strings as they are requested, that would be stored elsewhere.

However I don't fully understand how this script works. What do I put in the place of "text"?

From what I do understand I need to put in an array index somewhere, but where and how? I've never used them before, and the section in the manual didn't clarify with me how exactly I was supposed to use them in my script.

Apologies if I'm asking too many little questions. I'm just trying to establish what I do and don't understand.
SMF spam blocked by CleanTalk