SOLVED: using inventory on player script problem

Started by Slasher, Mon 22/10/2012 07:42:19

Previous topic - Next topic

Slasher

I'm having some issues with using inventory on player.

Can someone please have a look for me and correct?

Will you assist?

It mainly appears to be when using crystal / chalk and using brownjar crops up a bit.

I apologise if somewhat messy

Meanwhile I will keep looking over it.

Script taken off now solved




Crimson Wizard

#1
Slasher, you could at least tell what's wrong is going on when you use this script....

But based on dialog inside the script I may make a guess that you have mistakes in conditions.
For example:

Code: ags

if (cELF.ActiveInventory==ibluejar && cELF.Room==25 || cELF.Room==26 || cELF.Room==27)

This is probably supposed to deal this case when elf usues blue jar in rooms 25,26 and 27. But in fact it reads:
Quote
If active inventory is ibluejar AND room is 25
OR
room is 26
OR
room is 27
If you want this:
QuoteIf active inventory is ibluejar AND room is EITHER 25,26 or 27
You should take || operation in brackets:
Code: ags

if (cELF.ActiveInventory==ibluejar && (cELF.Room==25 || cELF.Room==26 || cELF.Room==27) ) <-- notice extra brackets there around "rooms" part


This is because of order of operations: && operation is executed first, and || operations are executed after.

There are other instances of this mistake in your code.

Slasher

I can't believe I did what I did  :-[

thank you so much Crimson

8-)




SMF spam blocked by CleanTalk