Page 1 of 1

fun code help..

Posted: 14 Sep 2018, 15:41
by choggoba
Thank you for always being kind to me.



my intention:

when
cityRotation =0 and build road sign5(road deco)

=> set $rn_choggoba = 1

but $rn_choggoba does not change... :cry:




Code: Select all

"fun":
    [{
	 "condition":
        {
          "type":"and","inner":[
            {"type":"value","code":"cityRotation","z":0},   
            {"type":"building","id":"road sign5"}]
			
        },
	
	 "actions":[{"type":"set","id":"$rn_choggoba","code":"1"}],
	
	"always":true
    }],


Re: fun code help..

Posted: 14 Sep 2018, 15:47
by ElephantEthan

Code: Select all

"fun":
    [{
	 "condition":
        {
          "type":"and","inner":[
            {"type":"value","code":"cityRotation","z":0},   
            {"type":"building","id":"road sign5"}]
			
        },
	
	 "actions":[{"type":"set","id":"$rn_choggoba","code":"1-$rn_choggoba"}],
	
	"always":true
    }],

Try this, it will set the variable to 1, using it again afterwards will set it to 0 then 1 etc. To read, use the same way like you did with city rotation.

Code: Select all

            {"type":"value","code":"$rn_choggoba","z":1}

Variables are weird to work with, I had a lot of trouble with them. @choggoba