Inventory problem

Started by sentient, Thu 20/05/2004 21:57:39

Previous topic - Next topic

sentient

Hello. I'm still stuck at the moment. I can't see any option in the inventory for checking if you have an item or not. I have a dialog I have set up with gets to a point and runs the run-script 1 command. In this script I want to check if you are carrying a certain item and to check against 4 variables i will want to have to check have been trigered. eg 1=triggered 0=not triggered. I can maybe set a flag for when you first pick up the object to do it, but that seems silly in a package designed for adventures. Is there a way to check if you are carrying a specific inv item or not?

Scorpiorus

Check out Text script global variables in the manual.

character[CHARID].inv[ x ]

So, you can have:

if (character[GetPlayerCharacter()].inv[5] > 0) {

Ã,  //run code only if the player has item (one or more) number 5

}

sentient

I really can't get my head around this scripting lark it is completley different from what I've done before. What is wrong with this ?


// main global script file
function dialog_request (int locationselect){
if (locationselect == 1)
if (character[GetPlayerCharacter()].inv[1] > 0);
SetPlayerCharacter(HANSON)}

Scorpiorus

Just two little corrections ;)

// main global script file
function dialog_request (int locationselect){
if (locationselect == 1)
if (character[GetPlayerCharacter()].inv[1] > 0) //no need for ';' here
SetPlayerCharacter(HANSON);
}

sentient

I've tried it as you said, but it still won't run. It says :
error: line3 expected ;

I've put a semi colon on the end of line 3 then it comes up with another error

Scorpiorus

Hmm, strange...

Could you copy&paste here what you have there now?

sentient

// main global script file
function dialog_request (int locationselect){
if (locationselect == 1)
if (character[GetPlayerCharacter()].inv[5] > 0)
SetPlayerCharacter(HANSON)};

that is what I have at the moment

sentient

This is right at the top of the global script. Line 3 is the if (locationselect ==1..... line.

Scorpiorus

#8
Swop them ;)
...
SetPlayerCharacter(HANSON); }

sentient

That worked. I now can use these scripts to go to the room I want. I'm not sure how I can limit the initial options now. I only want say 1 option to be available in the dialogue until I have talked to a character for instance. Then the new location becomes clear and is added into the options. How would I do this? I can untick the show option to stop the options being shown. But where would I use the show command?

Scorpiorus

Check out a SetDialogOption (int topic, int option, int new_state) function in the manual to handle dialog options from within the text script.

Also, take a look into Conversations section where you'll find information about how to manipulate the options with the dialog script (see: option-off X, option-off-forever X, option-on X).

sentient

Every time I try to use this manual I have I wonder if it is the right one. On page 31, the scripting tutorial1 and 2 simply say wibble and wobble??!! Is this in all the manuals? I downloaded the 2.4 manual off the website and printed it off, all 133 pages.  I hope this is the right one.

SMF spam blocked by CleanTalk