path to savedata? [resolved]

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
CherryDelight
Posts: 32
Joined: January 14th, 2012, 10:40 pm

path to savedata? [resolved]

Post by CherryDelight »

Short Version: Is there a WML-understood filepath to a user's save data?

Long Version: I wanted to see if I could implement a "New Game+"-esque feature in my campaign (I don't actually plan to, I just wanted to see if it could be done). Here's what I'm trying to do in _main.cfg's [campaign] tag:

Code: Select all

#ifhave ((filepath))
  # to check for replay of final scenario
    difficulties=EASY,MEDIUM,HARD
#else
    difficulties=EASY,MEDIUM
#endif
The problem is, I can't suss out the filepath, if there is one. ~/ shortcuts directly to .wesnoth-x.x/data/; I tried to use ~/../saves/ to get into .wesnoth-x.x/saves (which I knew wouldn't work, but I had to try anyway), and still no luck.

Is there an alternate filepath I can use to #ifhave a saved game, or is this just never going to happen?

Note: I know there could be risks in allowing calls to save files from inside the game, and I'll understand if this isn't possible at all. I just want to be certain.
Last edited by CherryDelight on January 20th, 2012, 12:36 am, edited 1 time in total.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: path to savedata?

Post by Anonymissimus »

CherryDelight wrote:#ifhave a saved game
No way to check from the perspective of wml/lua extension code.
The saves dir isn't preprocessed (unless I'm badly mistaken).
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: path to savedata?

Post by Exasperation »

I don't think accessing a saved game directly is possible, but you should be able to pass values from one playthrough of a campaign to another using persistent variables.
CherryDelight
Posts: 32
Joined: January 14th, 2012, 10:40 pm

Re: path to savedata?

Post by CherryDelight »

Exasperation wrote:I don't think accessing a saved game directly is possible, but you should be able to pass values from one playthrough of a campaign to another using persistent variables.
That completely slipped under my radar, and is even better than what I was hoping for. Thanks!
Post Reply