Scenario Following Code

Discussion and development of scenarios and campaigns for the game.

Moderators: Forum Moderators, Developers

Post Reply
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Scenario Following Code

Post by Darth Fool »

I have developed a little perl script to help me navigate through the campaign files which others might find useful for themselves or for making templates for a strategy guide or whatever. Basically you pass it a wesnoth directory and it parses the files in data/scenarios/ to produce a web page that you can use to see which scenarios lead to which other scenarios and then look at the scenario file. For fun I list everything inside of [side] tags and print the images of units defined or recruitable in all non-human controlled sides. Note that surprises (like in the ford of Abez) are not displayed. It is pretty crude right now and isn't really a WML parser, so it certainly can be fooled, but since it meets my needs, i have no further plans for it. If anyone wants to mod it, as always, feel free to post mods here. if you aren't a perl programmer but would like some new features added, just post a request and I'll see what I can do.

to use it (in linux) run a command like:

./scenario_follower.pl /usr/local/share/wesnoth/ > test.html

Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

the output looks nice, but there are already some job done on WML parsing in perl, for the unit.cgi script... you might find some interesting code to reuse in the threads about that script...

Shade
Posts: 1111
Joined: April 18th, 2004, 11:17 pm

My God

Post by Shade »

That just gave me w**d. Sweet!

Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

I have made some updates to this code. It now is more robust against WMLisms and is capable of processing v0.8.1 and also has some pretty graphs made with graphviz (http://www.research.att.com/sw/tools/graphviz/). The graphs are currently not part of the page itself just linked to. The 0.8.1 v is available at http://gravity.psu.edu/~mcnabb/wesnoth/ ... 0.8.1.html although I don't know how long I will be able to maintain this page here.
A sample of the graph is included below.

Also an extra command line argument that enables you to enter something other than file://path has been included to make it better for making web pages.

The code was run with the command line:
./scenario_follower.pl wesnoth-0.8.1 http://gravity.psu.edu/~mcnabb/wesnoth/ > wesnoth-0.8.1.html

ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

Here is a small patch to fix a syntax error and some warnings if dot is not available.

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

any chance of a repost? forum crash deletion. :)
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm

ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

Here is a zip file with Darth Fool's original script, my trivial patch, and the patched script (called scenario_follower without the .pl suffix). Note that the patch does not fix the script to deal with post-0.8.1 WML changes.
Attachments
scen.zip
(6.56 KiB) Downloaded 429 times

User avatar
Jetrel
Art Director
Posts: 7242
Joined: February 23rd, 2004, 3:36 am
Location: Midwest US

Re: My God

Post by Jetrel »

Shade wrote:That just gave me w**d. Sweet!
:shock: um, are we doing a Jean Louis Gassé, or Guy Kawasaki impression here?

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

ott wrote:Here is a zip file with Darth Fool's original script, my trivial patch, and the patched script (called scenario_follower without the .pl suffix). Note that the patch does not fix the script to deal with post-0.8.1 WML changes.
I'll see if i can figure out whats happening if there are any bugs. (key word being see. its not likely i will be able to. :) )
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

OK, it seemed to work basically correct... this is the output i get... the only thing is it doesn't have the images, which i guess results from the error message at the top.

Code: Select all

joe@slapstick:~/Scen_Fol_Cod$ ./scenario_follower.pl ~/wesnoth/wesnoth/ > test.html
main::units_in_side() called too early to check prototype at ./scenario_follower.pl line 312.
An_Island has only one node
BrokenBridge has only one node
High_King_at_Sea has only one node
forest_fear has only one node
multiplayer_Blitz has only one node
multiplayer_Charge has only one node
multiplayer_battleworld has only one node
multiplayer_castles has only one node
multiplayer_test has only one node
wesbowl has only one node
weslin_bridge has only one node
A_New_Chance
tutorial-2
Brother_Against_Brother
A_Summer_of_Storms
Skull_Agarash
The_Fall
Mages_And_Elves
A_Harrowing_Escape
Inside_The_Tower
The_Midlands
The_River_Road
Crelanus_Book
The_Oldwood
Confrontation
Temple_in_the_Deep
Underground_Pool
Return_to_Oldwood
An_Island
Clearwater_Port
BrokenBridge
Fallen_Lich_Point
End_Of_Peace
Sewer
Toward_Mountains_of_Haag
Southbay_in_Winter
The_Siege_Of_Barag_Gor
A_Final_Spring
To_the_harbour_of_Tirigaz
Peoples_in_Decline
Black_Flag
Rough_Landing
Desert_Of_Death
A_New_Land
Silent_Forest
Elf_Lords
Shan_Taum_The_Smug
A_Beach
The_Dragon
Troll_Hole
Cursed_Isle
A_Spy_in_the_Woods
Saving_Inarix
The_Vanguard
Clash_of_armies
Return_of_the_Fleet
High_King_at_Sea
The_Plan
The_Elves_Besieged
Rise_of_Wesnoth
Blackwater_Port
Epilogue
The_Isle_of_Anduin
The_Outpost
The_Bay_of_Pearls
Escape_Tunnel
Isle_of_the_Damned
Muff_Malals_Peninsula
Unexpected_Appearance
The_Siege_of_Elensefar
Undead_Border_Patrol
Elven_Alliance
Crossroads
Mal-Ravanals_Capital
Northern_Outpost
The_Princess_of_Wesnoth
Two_Paths
The_Valley_of_Death-The_Princesss_Revenge
Undead_Crossing
Crossing
Gryphon_Mountain
Ogre
The_Ford_of_Abez
Tribe
Northern_Winter
Lake
Mountain_Pass
Captured
The_Dwarven_Doors
Evacuation
Plunging_into_the_Darkness
The_Drowned_Plains
The_Lost_General
Approaching_Weldyn
Hasty_Alliance
Throne
Sceptre
Weldyn_Attack
A_Choice_Must_Be_Made
Duel
Reject
Snow_Plains
Swamp_Of_Dread
forest_fear
multiplayer_Blitz
North_Elves
multiplayer_Charge
multiplayer_battleworld
Elven_Council
multiplayer_castles
multiplayer_test
valley_statue
tutorial
wesbowl
return_to_wesnoth
weslin_bridge
trial_clans
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm

Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

I will poke around with this tonight and see if I can get it to work.

Post Reply