Pointers please

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
Fuergrissa
GamingTools Subscriber
Posts: 31
Joined: Fri Jul 16, 2004 2:46 am

Pointers please

Post by Fuergrissa » Fri Sep 01, 2006 9:39 am

Is there a way to start a script in the middle !

Ie my main routine consists of "Calls" like most so i was wondering if i wanted to start at a certain call and then work forward from there.

Code: Select all

 call UnDock
      call WarpToBelt
      call LoadMining
      call ApproachRoid

      BailOut:Set[${LavishScript.RunningTime}+(1000*240)]

      call LockAndLoad
      call CheckCargoFull
      call DockAtStation
      call WaitDocked
      wait 50
      call DragToHangar
      call StackAll
      call LogoutTimerFunction
      wait ${Math.Rand[100]:Inc[100]}
is it even possible please.

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Fri Sep 01, 2006 11:40 am

Sure. Learn about branching methods, like "if". http://www.lavishsoft.com/wiki/index.ph ... Structures

I'm sure if you think about it you might be able to come up with something. Also remember that any function, including main, can take parameters.

Fuergrissa
GamingTools Subscriber
Posts: 31
Joined: Fri Jul 16, 2004 2:46 am

Post by Fuergrissa » Fri Sep 01, 2006 4:08 pm

Thanks for the pointer Lax, I took a look and still no better off, I think i am being a little too ambitious. I read the section you linked but i still cannot even begin to understand how i would start a script part way through by passing a parameter.

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Sat Sep 02, 2006 10:49 am

Ok... here's a simplistic example...

Code: Select all

 
      if ${MyParameter==1}
      {
         call UnDock
         call WarpToBelt
         call LoadMining
         call ApproachRoid
      }
      BailOut:Set[${LavishScript.RunningTime}+(1000*240)]

      call LockAndLoad
      call CheckCargoFull 
      call DockAtStation
      call WaitDocked
      wait 50
      call DragToHangar
      call StackAll
      call LogoutTimerFunction
      wait ${Math.Rand[100]:Inc[100]}

Fuergrissa
GamingTools Subscriber
Posts: 31
Joined: Fri Jul 16, 2004 2:46 am

Post by Fuergrissa » Sat Sep 02, 2006 11:30 am

but when it cycles my parameter wont be 1 ? or am i missing the boat

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Sat Sep 02, 2006 11:50 am

Parameter:Set[1]

You're missing a lot of boats. :)

Fuergrissa
GamingTools Subscriber
Posts: 31
Joined: Fri Jul 16, 2004 2:46 am

Post by Fuergrissa » Sat Sep 02, 2006 1:35 pm

Now im starting to understand it i think heheh, Thanks Lax.

Sethric
GamingTools Subscriber
Posts: 17
Joined: Wed Oct 27, 2004 11:26 pm

Post by Sethric » Fri Oct 27, 2006 7:35 pm

How about like this.
if you use this while you are docked, it'd undock you with the ExitStation call, if you were already undocked, it'd go straight to WarptoBelt and skip the ExitStaion call.
Of course you have to fix up something that'll end up to be the CheckDocked part that'll tell it if you're docked or not.

Code: Select all

function DoStuff() 
{ 
   call CheckDocked 
   if ${Return.Equal[1]} 
   { 
	echo Currently Docked, so Undocking NOW.
	call ExitStation	
   } 
   else 
   { 
	echo I'm Already Undocked.
	call WarpToBelt
	call LoadMining
	call ApproachRoid
   } 

   Wait ${Math.Rand[50]:Inc[200]} 
} 


Post Reply