Scripting Help?
Moderators: Bob the Hamster, marionline, SDHawk
Scripting Help?
Working on a script, Surlaw helped me by setting it up, but when I go to compile it gives me an error. Can anyone help out as to why it might be messin up? I've been messing with it for a while. Different things happen based on how far away you are from the NPC in question.
if
(distance < 10)
then(heatsensorverynear)
if
(distance > 10),and, (distance < 30)
then(heatsensornear)
if
(distance > 30),and, (distance < 60)
then(heatsensormedium)
if
(distance > 60)
then(heatsensorcold)
end
if
(distance < 10)
then(heatsensorverynear)
if
(distance > 10),and, (distance < 30)
then(heatsensornear)
if
(distance > 30),and, (distance < 60)
then(heatsensormedium)
if
(distance > 60)
then(heatsensorcold)
end
Last edited by RMZ on Thu Dec 23, 2010 1:26 am, edited 1 time in total.
<a href="http://www.redtrianglegames.com">Check out Red Triangle Games!</a>
- The Wobbler
- A Scrambled Egg
- Posts: 2615
- Joined: Mon Oct 15, 2007 8:36 pm
- Location: Underwater
- Contact:
Try this:
if
(distance > 10,and,distance <30)
then(heatsensormedium)
I think it was just closing the parenthesis too early.
if
(distance > 10,and,distance <30)
then(heatsensormedium)
I think it was just closing the parenthesis too early.
Last edited by The Wobbler on Thu Dec 23, 2010 2:26 am, edited 1 time in total.
- Spoonweaver
- Liquid Metal King Slime
- Posts: 6247
- Joined: Mon Dec 08, 2008 7:07 am
- Location: Home
- Contact:
Yea, Surlaw's right.
Also, you'll want to use " >= " or " <= " and not " < " or " > "
And I'm assuming "distance" is a global variable and it's found and stored in the right way.
Also, you'll want to use " >= " or " <= " and not " < " or " > "
And I'm assuming "distance" is a global variable and it's found and stored in the right way.
Last edited by Spoonweaver on Thu Dec 23, 2010 3:13 am, edited 4 times in total.
- The Wobbler
- A Scrambled Egg
- Posts: 2615
- Joined: Mon Oct 15, 2007 8:36 pm
- Location: Underwater
- Contact:
If you do use >= and <= be sure to rewrite the numbers as:
if
(distance <= 10)
then(heatsensorverynear)
if
(distance => 11,and,distance <= 30)
then(heatsensornear)
if
(distance >= 31,and,distance <= 60)
then(heatsensormedium)
if
(distance >= 61)
then(heatsensorcold)
if
(distance <= 10)
then(heatsensorverynear)
if
(distance => 11,and,distance <= 30)
then(heatsensornear)
if
(distance >= 31,and,distance <= 60)
then(heatsensormedium)
if
(distance >= 61)
then(heatsensorcold)
Last edited by The Wobbler on Thu Dec 23, 2010 3:22 am, edited 1 time in total.
- Spoonweaver
- Liquid Metal King Slime
- Posts: 6247
- Joined: Mon Dec 08, 2008 7:07 am
- Location: Home
- Contact:
- The Wobbler
- A Scrambled Egg
- Posts: 2615
- Joined: Mon Oct 15, 2007 8:36 pm
- Location: Underwater
- Contact:
I wrote it perfectly and then it got screwed up when I tried to post (disabling HTML, BBCode, and smilies was needed) so I just recopied it from the original post and didn't fix it this time
You're right, I was writing this without access to anything OHR related and it's been too long since I scripted much so I knew I'd miss little things.Calehay wrote:On that same note, if you really want "greater than" or "less than," you have to use two symbols instead of one. (>> and << respectively.)
Last edited by The Wobbler on Thu Dec 23, 2010 3:26 am, edited 1 time in total.
K, well Spoonweaver, you helped me indirectly. I had posted this error, and then Worthy helped me sort it out, but now, my Bat Radar isn't working properly.
#if (distance<2)
# story scripts for mission
if
((distance <= 5))
then(heatsensorverynear)
if
((distance >= 5),and, (distance <= 20))
then(heatsensornear)
if
((distance >= 20),and, (distance <= 40))
then(heatsensormedium)
if
((distance >= 40))
then(heatsensorcold)
Any chance this is based on something besides tiles? Because it stays bright red (verynear) until I walk WELL over 5 tiles away. Thoughts? Surlaw you wrote this puppy, any ideas on the math part earlier in the script, I didn't post it here because I didn't want to ruin the secret boss.
#if (distance<2)
# story scripts for mission
if
((distance <= 5))
then(heatsensorverynear)
if
((distance >= 5),and, (distance <= 20))
then(heatsensornear)
if
((distance >= 20),and, (distance <= 40))
then(heatsensormedium)
if
((distance >= 40))
then(heatsensorcold)
Any chance this is based on something besides tiles? Because it stays bright red (verynear) until I walk WELL over 5 tiles away. Thoughts? Surlaw you wrote this puppy, any ideas on the math part earlier in the script, I didn't post it here because I didn't want to ruin the secret boss.
Last edited by RMZ on Thu Dec 23, 2010 3:23 am, edited 1 time in total.
<a href="http://www.redtrianglegames.com">Check out Red Triangle Games!</a>
- The Wobbler
- A Scrambled Egg
- Posts: 2615
- Joined: Mon Oct 15, 2007 8:36 pm
- Location: Underwater
- Contact:
Write a line to display the value of the distance variable on the screen so you can see what it's displaying as and let me know if the numbers look wrong. I think it just needs to be "show value (distance)" right?
Also you could try "hero pixel x (find hero whatever)" in the heat sensor scripts being called instead of just "hero x" to give yourself more precise control.
Also you could try "hero pixel x (find hero whatever)" in the heat sensor scripts being called instead of just "hero x" to give yourself more precise control.
Last edited by The Wobbler on Thu Dec 23, 2010 3:34 am, edited 2 times in total.
The lower the values, the easier it is to see it change. But it doesn't seem to read accurately. I can send the game and script files over if need be.
Nevermind, the thing works, wonderfully now. Should make for a great dungeon mechanic.
Nevermind, the thing works, wonderfully now. Should make for a great dungeon mechanic.
Last edited by RMZ on Thu Dec 23, 2010 6:26 am, edited 1 time in total.
<a href="http://www.redtrianglegames.com">Check out Red Triangle Games!</a>
- Blacklight_Studios
- Red Slime
- Posts: 29
- Joined: Sat Jan 08, 2011 7:26 pm