I got this error when I run my game:
Error: run_text_script1: error -6 running function 'repeatedly_execute':
Error: Null pointer referenced
In Global Script (Line 71)
Here's my script:
(the asterisk is the line where I get the error)
function repeatedly_execute() {
if (maincharacter == 0){
* Jactiveitem.Text = cJohn.ActiveInventory.Name;
Jdescription.Text = item[cJohn.ActiveInventory.ID].description;
}
}
Basically what I'm trying to do is display an item's description on a GUI label.
Most likely you won't have an Active Inventory item when you first start the game, which is why it kicks out the error. Add a check for that, e.g.:
function repeatedly_execute() {
if (maincharacter == 0 && cJohn.ActiveInventory != null){
Jactiveitem.Text = cJohn.ActiveInventory.Name;
Jdescription.Text = item[cJohn.ActiveInventory.ID].description;
}
}
You might also add an 'else' so the Labels display "No Item/ No further Information"-type messages when there's no Active item.
It works. :) Thanks.