| View previous topic :: View next topic |
| Author |
Message |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Thu Aug 30, 2007 9:23 pm Post subject: Steller Manipulations Work |
|
|
OK, I just heard from the source, steller manipulations are coded to work. Now all I have to do is actually write the code correctly to get warp points to close!!
Back to top |
|
 |
Kepper Space Emperor

Joined: Jun 01, 2006
|
Posted: Thu Aug 30, 2007 9:48 pm Post subject: |
|
|
Great news, is there any devolvement in the next version of your mod.
Back to top |
|
 |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Fri Aug 31, 2007 8:54 pm Post subject: |
|
|
I plan to work the warp closing points this weekend, hopefiully I can get them to close 
Back to top |
|
 |
Fyron Galactic Guru

Joined: Aug 04, 2003 Location: CA, USA
|
Posted: Fri Aug 31, 2007 9:27 pm Post subject: |
|
|
Events are not "stellar manipulations"... are you sure he said the WP close event function works?
Smarter than your average Texrak.
Back to top |
|
 |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Sat Sep 01, 2007 9:02 pm Post subject: |
|
|
| Fyron wrote: | | Events are not "stellar manipulations"... are you sure he said the WP close event function works? |
Your right, after re-reading his email he referenced the steller manipulations via empire AI, not external event script. We'll see if Aaron doesn't mind me bothering him one more time 
Back to top |
|
 |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Tue Oct 23, 2007 11:16 am Post subject: |
|
|
I got them to work, however it only closes one per turn. I thought I looped the instructions to close ALL the warp points. Anyone familair with script code to see where I might have gone wrong?
//------------------------------------------------------------------------
// Main
//------------------------------------------------------------------------
function Main returns boolean
begin
// Close Warp Points
call sobjWP_list.clear()
call Sys_Get_List_Of_Space_Objects_Of_Type(SPACE_OBJECT_TYPE_WARP_POINT, sobjWP_list, FALSE, FALSE, 0)
set listWP_count := sobjWP_list.count()
set loopWP_count := 1
set Index_WP := 1
if (listWP_count > 0) then
set objWP_id := sobjWP_list.Get(Index_WP)
call Sys_Close_Warp_Point(objWP_id)
call sobjWP_list.clear()
call Sys_Get_List_Of_Space_Objects_Of_Type(SPACE_OBJECT_TYPE_WARP_POINT, sobjWP_list, FALSE, FALSE, 0)
set listWP_count := sobjWP_list.count()
endif
This is about the seven re-write to try different ways of closing the warp points so if the script logic looks redundant and over kill its because of that.
Here is another attempt, same result: only one warp point each turn:
//------------------------------------------------------------------------
// Main
//------------------------------------------------------------------------
function Main returns boolean
begin
set lng_Datafile_Event_Text_ID := Sys_Load_Datafile(0, AI_MAIN_EVENT_EVENTTEXT_TXT)
call Sys_Get_List_Of_Space_Objects_Of_Type(SPACE_OBJECT_TYPE_WARP_POINT, sobjWP_list, FALSE, FALSE, 0)
set listWP_count := sobjWP_list.count()
set loopWP_count := 0
if (loopWP_count < listWP_count) then
set loopWP_count := loopWP_count + 1
set objWP_id := sobjWP_list.Get(loopWP_count)
call Sys_Close_Warp_Point(objWP_id)
endif
Back to top |
|
 |
CaptainKwok Balance Guru

Joined: Aug 04, 2003 Location: Toronto, Canada
|
Posted: Tue Oct 23, 2007 12:14 pm Post subject: |
|
|
You're lacking either a for or loop statement to cycle through all the warp points. Right now you're just identifying the first one in the list and closing it.
Should work ok:
function Main returns boolean
begin
call Sys_Get_List_Of_Space_Objects_Of_Type(SPACE_OBJECT_TYPE_WARP_POINT, sobjWP_list, FALSE, FALSE, 0)
set listWP_count := sobjWP_list.count()
set loopWP_count := 0
loop
set loopWP_count := loopWP_count + 1
set objWP_id := sobjWP_list.Get(loopWP_count)
call Sys_Close_Warp_Point(objWP_id)
exitwhen (loopWP_count >= listWP_count)
endloop
Warning:
Watch out to see if the IDs of the WPs change as you close them. This will cause you to only close 50% of the WPs in existence. If that is the case, then some adjustments will be required.
Space Empires Depot | SE:V Balance Mod
Back to top |
|
 |
Fyron Galactic Guru

Joined: Aug 04, 2003 Location: CA, USA
|
Posted: Tue Oct 23, 2007 2:50 pm Post subject: |
|
|
sobjWP_list shouldn't have its indexes change, since its just (presumably) storing references to the WP objects. Sys_Close_Warp_Point() is just taking an integer, right? It doesn't matter if the actual "ID" value those WP objects store changes, cause you are only reading in the ID for the next WP to delete on the loop iteration.
If Aaron did some untoward things with his lists of references to objects, at worst you just have to iterate through the list backwards, deleting the first object each time:
| Code: | // can remove the set listWP_count variable now, since we aren't using it in the reverse-iteration loop.
set loopWP_count := sobjWP_list.count()
loop
set loopWP_count := loopWP_count - 1
set objWP_id := sobjWP_list.Get(0)
call Sys_Close_Warp_Point(objWP_id)
exitwhen (loopWP_count <= 0)
endloop |
Note that the Get(0) might need to be Get(1) if the script language has lists/arrays indexed by 1 instead of 0.
Smarter than your average Texrak.
Back to top |
|
 |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Tue Oct 23, 2007 3:53 pm Post subject: |
|
|
Thanks guys, I knew I would probably draw your two answers
I did try some different loops but ended up on just closing one each turn out of frustration.
I'll give it a go and report back.
Fyron might be on to something with the iteration direction needing to cycle through backwards, that would explain some of the other looping/ if then attempts I tried not succeeding in closing all but just one, the last one.
We'll see....
Back to top |
|
 |
CaptainKwok Balance Guru

Joined: Aug 04, 2003 Location: Toronto, Canada
|
Posted: Tue Oct 23, 2007 4:19 pm Post subject: |
|
|
Sorry I got my wires crossed. There shouldn't be a problem with references as Fyron stated. It is only an issue if you are deleting entries from the list variable itself.
Space Empires Depot | SE:V Balance Mod
Back to top |
|
 |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Tue Oct 23, 2007 4:35 pm Post subject: |
|
|
My intent on implementing this scheme is to have all the warp points deleted at end of turn so there is no need to carry a list forward but just generate a new list based on what warp points are opened during the turn.
I tried the deleting the list index point, I might have gotten it right but hard to tell since it only closed one WP at a time. I did do a variable dump and it did collect the entire selection of WPs.
Again, thanks to both Fyron and Captain Kwok. You guys rock
Back to top |
|
 |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Tue Oct 23, 2007 10:17 pm Post subject: |
|
|
Right on the money!
Closes all the warp points in one end turn cycle. also, Fyron was right, it does index at 1 not 0 and it doesn't change the index count after one is closed.
Your script text was 99% on the money, Captain Kwok (you just forgot the endloop line ) or you where making sure I learned something, either way, thanks again.
Back to top |
|
 |
CaptainKwok Balance Guru

Joined: Aug 04, 2003 Location: Toronto, Canada
|
|
 |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Tue Oct 23, 2007 10:38 pm Post subject: |
|
|
might be part of my problem: vision and failure to read, sorry.
I stand corrected, your 100% correct.
Thanks again
Back to top |
|
 |
Noble713 Space Emperor

Joined: Apr 24, 2006
|
Posted: Mon Oct 29, 2007 6:55 pm Post subject: |
|
|
I haven't done any SE5 scripting, so maybe the answer to this is obvious:
Is it possible to differentiate between "natural" and "artificial" warp points? Is there a way to get a list of, for example, only the "artificial" ones? I know this won't work using the Sys_Get_List_Of_Space_Objects_Of_Type, but is it possible to use another method to get a list of objects? Perhaps all objects in a system with a certain ability tag? I'm wondering if there is a way to keep the "natural" points open while points generated by ship FTL drives get closed.
I don't want the natural points to close because:
1. They point to specific systems.
2. They allow ships without FTL drives to make interstellar journeys.
Back to top |
|
 |
isopsyco Space Emperor

Joined: Dec 31, 2006 Location: Always moving...
|
Posted: Mon Oct 29, 2007 7:42 pm Post subject: |
|
|
I imagine you could adjust the script to account for all the 'natural' WPs by taking an account list then comparing it to the next turns number. If any new WP opened (FTL style) then the script would only close ID numbers 200 and up (199 and below where the natural, WPs the game started with).
Since the external events are now active, any WPs created by random event would also get closed though. Unless you delete WP random open and close event.
It sounds workable.
Back to top |
|
 |
Fyron Galactic Guru

Joined: Aug 04, 2003 Location: CA, USA
|
Posted: Mon Oct 29, 2007 11:15 pm Post subject: |
|
|
For reference, there is no actual difference between "natural" and "artificial" warp points, once they are on the map.
Smarter than your average Texrak.
Back to top |
|
 |
|