logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
LetoScript (little help would be nice)

 
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
MrPip



Joined: 03 Oct 2009
Posts: 2

PostPosted: Sat Oct 03, 2009 9:03    Post subject: LetoScript (little help would be nice) Reply with quote

Well I need to do some heavy (heavy) manipulation of areas ... but before i jumped into that head first i thought i would try something a bit on the lower end to get comfortable with the language. So was trying a simple changing of all placeable descriptions in a given area.

Code:

string cChangeDescriptions = "/~/Description=q<"+ sText +"> for(/@/{q<Area Data>}/" +sAreaTag+".git/{q<Placeable List>});";


In the help files there was a example using


Code:
for('*.git' in %mod){
   #$_ is the name of the current resource
   pl "Checking area $_...";

   # Scan the creature list, and each creature's item list:   
   for(/{'Creature List'}){
      pl "Checking /~/Tag's inventory...";
      for(/~/ItemList){
         pl 'Snake skin found!' if /~/Tag eq 'DS_I_SNAKESKIN';
      }
   }
}


Which was nearest i could find for examples editing anything but bics lol

are you not able to directly reference the children inside a mod?
/@/Area Data/Area1.git/Placeable List/

which should return a LIST if correct? which i am just iterating over.
/~/Description
should reference the current nodes description inside that LIST, and modify it...

Guess question is, is my syntax off? Or can gits not be accessed as though they are a child node?

Here is the leto error message
Quote:
<335.1µs> Req:"SCRIPT", Param:"%mod = q<C:/NWNLIVE/modules/abcdefgh.mod> or die $!;/~/Description=q<This is a test lah.> for(/@/{q<Area Data>}/Area001.git/{q<Placeable List>});%mod = '>';close %mod;"


In game error (return message for letoscript) said invalid derefrence of git

any help would be grateful Confused
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Sun Oct 04, 2009 7:28    Post subject: Reply with quote

You say 'in game' error, which makes me think you're trying to run this on an active server. Leto edits files, not memory. First, you'd need to tell it what mod is, and you'd be pointing to a file - the changes you make would have no effect at all on the running server instance. In any event, you should try searching for 'letoscript' on the bioboards in NWN1 Scripting forum. Here's a thread that links to one of my primers, as well as offering a host of out-of-game utility functions:

http://nwn.bioware.com/forums/viewtopic.html?topic=691165&forum=47&sp=15

They're meant to be run using Moneo, from the Sourceforge leto page, not from a running server. LMK if you have further questions.

Funky
Back to top
View user's profile Send private message
MrPip



Joined: 03 Oct 2009
Posts: 2

PostPosted: Mon Oct 05, 2009 1:56    Post subject: Reply with quote

FunkySwerve wrote:
You say 'in game' error, which makes me think you're trying to run this on an active server. Leto edits files, not memory. First, you'd need to tell it what mod is, and you'd be pointing to a file - the changes you make would have no effect at all on the running server instance. In any event, you should try searching for 'letoscript' on the bioboards in NWN1 Scripting forum. Here's a thread that links to one of my primers, as well as offering a host of out-of-game utility functions:

http://nwn.bioware.com/forums/viewtopic.html?topic=691165&forum=47&sp=15

They're meant to be run using Moneo, from the Sourceforge leto page, not from a running server. LMK if you have further questions.

Funky

Well I am not trying to edit the memory...

... what I attempting to do is make modifications to the .mod so on next reboot the server will pull the new .mod into memory.




Example with pseudo:
[Letoscript ingame with nwnx bridge]
call letoscript->SavePlaceablesLocation(placeable);
nwnscript->CreatePlaceableInGameAtLocation(placeable);

Since the mod is loaded into memory, and unlike bic's doesn't dump its content back to disk after shutdown.

I should be able to just create a temporary ingame placeable and modify the mod with leto to keep it perm (like how .saves work by dumping everything including whats included in .gits)

Than when I need to make modification to mod i just shutdown server for update than run outside of game letoscript to merge any new placables into the new modiciated mod.

This would give the capabilitys of .sav's without the overhead of disk size, speed, hassle of modifying the script and saving stuff I do not want saved.


if you look at my leto log... I am opening a file ... the 'live' mod which is already in memory
Code:
<335.1µs> Req:"SCRIPT", Param:"%mod = q<C:/NWNLIVE/modules/abcdefgh.mod> or die $!;/~/Description=q<This is a test lah.> for(/@/{q<Area Data>}/Area001.git/{q<Placeable List>});%mod = '>';close %mod;"


"%mod = q<C:/NWNLIVE/modules/abcdefgh.mod> or die

The mod is opened at this time its found and the resources are accessible to me.

My code works perfect till (doesn't actually bomb out till it trys to directly access the git by name, doesn't mind accessing the /@ root or child <Area Data>) I try to give the path to the .GIT GFF

Invalid Ingame leto error would be the returned code from nwnx-leto bridge


The link you provide gave OUTSIDE of game modifications to areas which is all fine and dandy for when I actually have to do outside modifications as stated above... but ...

INGAME modifications (Like the modifications done for bics) I am having issues with.

Are you saying you can't do modifications to bic files after you boot a player?? The only reason I thought you couldn't modify the bic file while the player was in memory was cause when they leave/get booted/ the server dumps all data to the bic overwritting it... (Which isn't done by .mod's I didn't think considering they do not save any data)
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Mon Oct 05, 2009 3:27    Post subject: Reply with quote

You can use the code I linked from ingame, so long as you're not attempting to edit memory. The syntax is the same, and afaik it doesn't matter where you're calling it from, though I've never tried running it from a running mod on anything but a bic. In theory it should work.

Funky
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion All times are GMT + 2 Hours
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


Powered by phpBB © 2001, 2005 phpBB Group