If Atribute Value </>

I have an atribute "progress" set to ITEM at value 1.
I want an npc to react with msg if value is less then 5
And to react diferently when the value is greater then 4

How whould i achieve this effect?
Ive tried

item.progress = <5
Item.progress <= 5
Item.progress < 5

You are 90% there already...
A switch may be the easiest route to go.
First, add the "progress" to the character:
(I made a male character called Mark".)
go to the attribute tab, and added progress, and set it as Integer, with a value of 1
Then the switch code:

switch (Mark.progress) {
  case (1, 2, 3, 4) {
    msg ("Sorry, buy I don't know you that well.")
  case (5) {
    msg ("Sure friend, you can do that for me.")

Then you just need a way to increase, or decrease, the value.

I would have just used an if statement.

if (item.progress < 5) {
  msg ("You did not progress much.")
if (item.progress > 4) {
  msg ("You progressed very much!")
else {
  msg ("You did not progress.")

And then you add the progress attribute.

item.progress = item.progress + 1

I got an error, but in not sure what i did to cause it.

set (item. progress, 1)


switch (item.progress) {
  case (1,2,3,4) {
   msg ("TEST")


What is the error?

EDIT2 I forgot to correct this next line when I first posted this (and during the first edit). :)

I notice your first code block (set (item. progress, 1)) should be set (item, "progress", 1).

...but I'd just do item.progress = 1.

Po-tay-toe, po-tah-toe, though.

We really need to know what the error is to truly help you. And we might need more code.

By the way, I'm assuming your second sample block of code is just the first three lines from the block of code in the game, and I am therefore not going to mention its lack of completeness.

Anyway, what is your error? Can you copy it and paste it here?

It apears in-game not while editing at the part where the progress attribute whould be set

Error running script: Object reference not set to an instance of an object.

I notice your first code block (set (item. progress, 1)) should be set (item.progress, 1).

Should be set (item, "progress", 1). The set function takes 3 parameters; an object, an attribute name, and a value.

But yes, it's easier to type item.progress = 1.

During initial interaction with Vender i have

Item.progress= 1

Afterwords talking with him again whould cause

 switch (Item.progress) {
   case (1, 2, 3, 4) {
      msg ("NOT DONE YET")

What about 5 and above? Can i put >4 as another case? How whould i Increase the number by 1 during interaction with another npc?

Should be set (item, "progress", 1)

Ha! Yeah, I edited the post and still messed it up. Fixed it now.

Error running script: Object reference not set to an instance of an object.

It sounds like Item might not be set to an object (maybe).

I also notice the first post you have item and the second post you have Item. Quest is case-sensitive, so that could be the issue.

Where does item or Item come from in the code?

K.V. i just checked

The item is set to object and is named with Capital in all instances.
What if i start progress as an instalation script right on it, and +1 from there on?

Log in to post a reply.