lfnetwork.com mark read register faq members calendar

Thread: Variables in ICARUS
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 08-28-2006, 06:22 PM   #1
CalcProgrammer1
Rookie
 
CalcProgrammer1's Avatar
 
Join Date: Jul 2006
Posts: 91
Variables in ICARUS

I have a problem with a simple script (I am just starting scripting), and for some reason I can't get a script to use variables correctly, my spawnscript has

declare ( <DECLARE_TYPE> STRING, "OPEN" )
set ( "OPEN","NO")

OPEN is the state of a door, open or closed, and No means its closed
My trigger_multiple targets a target_scriptrunner, which uses the script, this part works so far, its the script that doesn't work cause it tells me it is comparing unlike types or something similar when developer is 1

My problem is with the script for the button

if ( $OPEN$,$=$,$"YES"$)
set ("OPEN","NO")
affect ("door",<AFFECT_TYPE>INSERT)
rotate ( <0 0 0 >, 1000)

if ( $OPEN$,$=$,$"NO"$ )
set ( "OPEN","YES" )
affect ( "door", <AFFECT_TYPE>INSERT)
rotate (<0 90 0>, 1000)

I also don't know how the Rotate function works, does it rotate by the given amount or rotate to the given position?
CalcProgrammer1 is offline   you may: quote & reply,
Old 09-11-2006, 03:52 AM   #2
lassev
cryptoscripter
 
lassev's Avatar
 
Join Date: Jun 2002
Location: Finland
Posts: 1,087
I hope there's an else somewhere in that script... But other than that, adopt better programming conventions and use a float (like 1=open, 0=closed). Nobody uses strings to check for such things. That should sort your problem without the need of even explaining what's wrong with your current one.

And rotate sets new absolute angles. JA doesn't unfortunately recognize relative rotation.


Frozen by ICARUS
lassev is offline   you may: quote & reply,
Old 09-11-2006, 04:00 PM   #3
CalcProgrammer1
Rookie
 
CalcProgrammer1's Avatar
 
Join Date: Jul 2006
Posts: 91
Well, I did try the 1, 0 thing before, and since it didn't work that is why I went with strings, I'll retry it, and about the Rotate, I figured out how that worked making rotating doors (which worked ok), my problem is I'm too used to BASIC where you don't have to declare everything...

I'll try that out.
CalcProgrammer1 is offline   you may: quote & reply,
Old 09-11-2006, 07:48 PM   #4
lassev
cryptoscripter
 
lassev's Avatar
 
Join Date: Jun 2002
Location: Finland
Posts: 1,087
Something like this:

Code:
if ( $get( FLOAT, "open") = 1$ )
	{
		rem ( "case 1" );
		affect ( "door", /*@AFFECT_TYPE*/ FLUSH )
		{
			rotate ( < 0.000 0.000 0.000 >, 1000.000 );
		}

		set ( "open", "0" );
	}


else (  )
	{
		rem ( "case 2" );
		affect ( "door", /*@AFFECT_TYPE*/ FLUSH )
		{
			rotate ( < 0.000 90.000 0.000 >, 1000.000 );
		}

		set ( "open", "1" );
	}
That code could be something of a Frankenstein; I just put it together from bits and pieces, but it should give some ideas.

You gotta get your syntax right first, then logic and such things.

And declaring variables is essential. It guarantees no typos and also JA has a limited amount of variables allowed (32 per type or something), so requiring declaring makes it easier to keep track of them. Although I can't imagine anybody needing 32 variables at the same time in JA...


Frozen by ICARUS
lassev is offline   you may: quote & reply,
Old 09-11-2006, 08:30 PM   #5
CalcProgrammer1
Rookie
 
CalcProgrammer1's Avatar
 
Join Date: Jul 2006
Posts: 91
Ahh! I didn't know about the get( thing. I was wondering how BehavEd knew the difference between a variable and a literal... Now I know.
CalcProgrammer1 is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Mapping > Variables in ICARUS

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:38 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.