|
General Forum |
 |
|

Malkin
     Manager

|
3/9/2009 | |
When you set a variable using setv, is it possible to set it to be, say, 13 (bug) OR 3 (seed)? Or do you have to use a DOIF to first do the coding for the 13, but then say if you don't see (ESEE?) any 13s, then setv to 3?
My TCR Norns |
 Prodigal Sock
Ghosthande
    

|
3/9/2009 | |
I don't think it would be possible to do it without adding *something* to tell the game when to use 3 instead of 13, or vice-versa; I believe you actually need something along the lines of the ESEE statement you mentioned above, or (from my experience) the value that was mentioned first will be used every time.
Or alternately you could set it to assign one of the two numbers to the variable randomly, using something like this:
setv va00 rand 1 2
doif va00 eq 1
setv ov00 13
else
setv ov00 3
endi
 |

Malkin
     Manager

|
3/10/2009 | |
Of course, when I say OR, I mean AND... oops. I want this critter to eat both bugs and seeds.
My TCR Norns |
 Prodigal Sock
Ghosthande
    

|
3/10/2009 | |
Oh, I get it.
If you're using a DOIF statement to determine whether an object is edible for your critter, you could use something like this:
DOIF rtyp room targ eq 5 OR rtyp room targ eq 7
This is grabbed right out of my Tulu moonflower's timer script; it determines whether a moonflower seed can sprout or not. The seed can use either of two room types, although it's possible to add any number of conditions by just tacking an "OR" and a new condition onto the end. You do have to type out the entire command all over again for each new condition; as above, I put "DOIF rtyp room targ eq 5 OR rtyp room targ eq 7". Putting "DOIF rtyp room targ eq 5 OR 7" doesn't work.
 |

Malkin
     Manager

|
3/13/2009 | |
Is it possible to set a va## randomly to 13 or 3 by "setv va48 rand 13 or 3"? Is that a valid statement?
My TCR Norns |
 Prodigal Sock
Ghosthande
    

|
3/14/2009 | |
Not that I'm aware of... or at least if it does I haven't gotten it to work. But you can get the same result this way:
setv va00 rand 1 2
doif va00 eq 1
setv va## 13
else
setv va## 3
endi
 |