Welcome to Spaceempires.net
Login or Register

Search

Modules
 Home

 Discussions
 Forums
 Members List
 SE IRC Chat
 SEnet News
 Newsletter
 News by Topic
 News Archive
 Submit News
 Files & Links
 Downloads
 Shipyards
 Upload File
 Web Links
 SEnet Content
 Content (Stories)
 FAQ
 Game Info
 Hangman
 ModWorks
 Top 10
 Strategy
 Surveys
 User Content
 Fan Fiction
 Image Gallery
 Pages
 SE.net Info
 Feedback
 Recommend Us
 Statistics
 Search
 Staff
 Your Info
 Journal
 Private Messages
 Your Account

User Info
· Welcome, Anonymous
Membership:
· New: Darth_Wreck
· New Today: 1
· New Yesterday: 1
· Overall: 1783

People Online:
· Visitors: 86
· Members: 0
· Total: 86

  

Spaceempires.net :: Steller Manipulations Work :: View topic
Forum FAQ :: Search :: Memberlist :: Usergroups :: Profile :: Log in to check your private messages :: Log in


Steller Manipulations Work

 
Post new topic   Reply to topic    Spaceempires.net Forum Index -> SEV AI Modding Discussion
View previous topic :: View next topic  
Author Message
isopsyco
Space Emperor


Joined: Dec 31, 2006
Location: Always moving...

PostPosted: Thu Aug 30, 2007 9:23 pm    Post subject: Steller Manipulations Work Reply with quote

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

PostPosted: Thu Aug 30, 2007 9:48 pm    Post subject: Reply with quote

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...

PostPosted: Fri Aug 31, 2007 8:54 pm    Post subject: Reply with quote

I plan to work the warp closing points this weekend, hopefiully I can get them to close Smile

Back to top
Fyron
Galactic Guru


Joined: Aug 04, 2003
Location: CA, USA

PostPosted: Fri Aug 31, 2007 9:27 pm    Post subject: Reply with quote

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...

PostPosted: Sat Sep 01, 2007 9:02 pm    Post subject: Reply with quote

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 Smile


Back to top
isopsyco
Space Emperor


Joined: Dec 31, 2006
Location: Always moving...

PostPosted: Tue Oct 23, 2007 11:16 am    Post subject: Reply with quote

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

PostPosted: Tue Oct 23, 2007 12:14 pm    Post subject: Reply with quote

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

PostPosted: Tue Oct 23, 2007 2:50 pm    Post subject: Reply with quote

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...

PostPosted: Tue Oct 23, 2007 3:53 pm    Post subject: Reply with quote

Thanks guys, I knew I would probably draw your two answers Smile

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

PostPosted: Tue Oct 23, 2007 4:19 pm    Post subject: Reply with quote

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...

PostPosted: Tue Oct 23, 2007 4:35 pm    Post subject: Reply with quote

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...

PostPosted: Tue Oct 23, 2007 10:17 pm    Post subject: Reply with quote

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 Smile) 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

PostPosted: Tue Oct 23, 2007 10:22 pm    Post subject: Reply with quote

I see endloop above so I don't know what you are you talking about... Shocked

Space Empires Depot | SE:V Balance Mod


Back to top
isopsyco
Space Emperor


Joined: Dec 31, 2006
Location: Always moving...

PostPosted: Tue Oct 23, 2007 10:38 pm    Post subject: Reply with quote

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

PostPosted: Mon Oct 29, 2007 6:55 pm    Post subject: Reply with quote

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...

PostPosted: Mon Oct 29, 2007 7:42 pm    Post subject: Reply with quote

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

PostPosted: Mon Oct 29, 2007 11:15 pm    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Spaceempires.net Forum Index -> SEV AI Modding Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
All logos and trademarks used on this site, all comments and stories posted for reading, all files hosted for download,
and all art work hosted for viewing are property of their respective owners; all the rest copyright 2003-2007 Nolan Kelly.
Syndicate news: SpaceEmpires.net News RSS Feed - Syndicate forums: SpaceEmpires.net Forums RSS Feed
Page Generation: 0.64 Seconds