Scripting Help?

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
RMZ
Liquid Metal Slime
Posts: 1441
Joined: Tue Oct 16, 2007 12:39 am
Contact:

Scripting Help?

Post by RMZ »

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
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>
User avatar
The Wobbler
A Scrambled Egg
Posts: 2615
Joined: Mon Oct 15, 2007 8:36 pm
Location: Underwater
Contact:

Post by The Wobbler »

Try this:

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.
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

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.
Last edited by Spoonweaver on Thu Dec 23, 2010 3:13 am, edited 4 times in total.
User avatar
The Wobbler
A Scrambled Egg
Posts: 2615
Joined: Mon Oct 15, 2007 8:36 pm
Location: Underwater
Contact:

Post by The Wobbler »

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)
Last edited by The Wobbler on Thu Dec 23, 2010 3:22 am, edited 1 time in total.
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

Surlaw, you just wrote the parenthesis wrong again.
User avatar
Calehay
Red Slime
Posts: 84
Joined: Mon Oct 15, 2007 10:48 pm

Post by Calehay »

On that same note, if you really want "greater than" or "less than," you have to use two symbols instead of one. (>> and << respectively.)
User avatar
The Wobbler
A Scrambled Egg
Posts: 2615
Joined: Mon Oct 15, 2007 8:36 pm
Location: Underwater
Contact:

Post by The Wobbler »

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 :(
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.)
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.
Last edited by The Wobbler on Thu Dec 23, 2010 3:26 am, edited 1 time in total.
User avatar
RMZ
Liquid Metal Slime
Posts: 1441
Joined: Tue Oct 16, 2007 12:39 am
Contact:

Post by RMZ »

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.
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>
User avatar
The Wobbler
A Scrambled Egg
Posts: 2615
Joined: Mon Oct 15, 2007 8:36 pm
Location: Underwater
Contact:

Post by The Wobbler »

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.
Last edited by The Wobbler on Thu Dec 23, 2010 3:34 am, edited 2 times in total.
User avatar
RMZ
Liquid Metal Slime
Posts: 1441
Joined: Tue Oct 16, 2007 12:39 am
Contact:

Post by RMZ »

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.
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>
User avatar
RMZ
Liquid Metal Slime
Posts: 1441
Joined: Tue Oct 16, 2007 12:39 am
Contact:

Post by RMZ »

Does anyone know if there's a command to change hero portraits like you can change hero battle and walkabout sprites? It'd be useful with the costume changes in my Batman game.

Thanks!
<a href="http://www.redtrianglegames.com">Check out Red Triangle Games!</a>
User avatar
Blacklight_Studios
Red Slime
Posts: 29
Joined: Sat Jan 08, 2011 7:26 pm

Post by Blacklight_Studios »

I can't find anything in the Wiki's dictionary that'll allow for portrait changes on textboxes. If it were a sprite change as a result of plot device, then you could just change the portrait in the text box editor.
HAHAHAHAHAHAHAHAHAHHA.......... No.
Post Reply