View unanswered posts | View active topics It is currently Sat Apr 27, 2024 4:56 pm



Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
 Help writing star wars dieroller 
Author Message

Joined: Thu Dec 10, 2009 6:37 am
Posts: 335
Post Re: Help writing star wars dieroller
Yes I got all that but I was thinking maybe use the XML entity for apostrophe ("'"). I think it is just apostrophes as we always use single quotes for the xml attributes. OTOH it seems like what is the use of an xml library that doesn't catch all this by itself so it may just be the preponderance of old code that creates xml directly from strings instead of using the xml libraries. You know the old code is littered with that stuff. It might need fixes all over the place but Fantasy names often have apostrophes in them, you know? So it seems like a serious bug.

Perhaps I should check the older versions for it too.


Mon Mar 15, 2010 10:55 pm
Profile
User avatar

Joined: Wed Dec 09, 2009 9:39 pm
Posts: 712
Post Re: Help writing star wars dieroller
That is why I was 100% for the decision Dj made to go with Element Tree and make the clients backwards compatible. 1.7.1 users don't know how outdated and insecure their code has become. Keep moving forward with Element Tree .. apologize to the users of older software and tell them what they are missing; hopefully they will update and then the problems should be over.

Until the next generation of code comes along. :ugeek:

_________________
I ate your Death Knell.
The Traipse Movement
Please show your support for Traipse OpenRPG http://www.facebook.com/MadMathLabs
Send me Traipse OpenRPG Ideas, Bugs, Complaints, Praises here: https://getsatisfaction.com/mml


Tue Mar 16, 2010 12:10 am
Profile YIM WWW

Joined: Sun Mar 14, 2010 6:59 pm
Posts: 5
Post Re: Help writing star wars dieroller
prof.ebral wrote:
It is, in Traipse. The major difference between the Traipse dieroller and the Standard dieroller is the utils.py script. You can copy the utils.py script from Traipse Ornery Orc to your current 'Standard', replacing the standard one, and then achieve that same functionality. I wrote the Warhammer Fantasy RPG dieroller that allows user to roll [3for], which stands for 3 Fortune dice. The user who commissioned the roller uses Standard.


Unfortunately I can't find an install for Traipse that works on Linux. I've looked inside the various archives available, but haven't found a utils.py. (There is a util.py).


Wed Mar 17, 2010 1:20 am
Profile

Joined: Sun Mar 14, 2010 6:59 pm
Posts: 5
Post Re: Help writing star wars dieroller
davidbyron wrote:
Personally I find plugins a lot easier to understand and write than die rollers but they are comparable. There is an example plugin called ... uh.... xxblank.py and the spell checker plugin is called xxspell.py (the file name has to begin with xx) xxspell.py does something quite similar but it has a customisable list of words and replacement words which are literals whereas you only want one thing checked for an replaced but you want a more sophisticated kind of search and replace.


Ok, now I might be getting somewhere. As near as I can tell, I need to take some of the existing code in utils.py and do some of that in my own plugin. I've begun the process, but I'm now stymied by the opacity of the code in utils.py. convertTheDieString() and stdDieToDClass() are confusing! Somehow I need to adapt these two functions to be called from pre_parse().

This would be simpler if a dieroller could be adapted to do it.


Wed Mar 17, 2010 1:24 am
Profile
User avatar

Joined: Wed Dec 09, 2009 9:39 pm
Posts: 712
Post Re: Help writing star wars dieroller
Madwand. You can import the class roller_manager from the utils.py and then remake the classes in your plugin.

I would do something like this.
Code:
from orpg.dieroller.utils import roller_manager

and then further down I would reassign the class's functions
Code:
roller_manager.stdDieToDClass = self.NewDieParser

And then create a function called NewDieParser
Code:
def NewDieParser(self, match):

and then recode it to your specifications.

Then, any time the roller_manager's stdDieToDClass function is called, the plugin will take over. You will need to create a secondary object to hold the previous function, something like roller_manager.stdDieToDClass = self.BackUp so when the plugin is turned off, you can reset the roller_manager's function again, just like this:
Code:
self.BackUp = roller_manager.stdDieToDClass

What you want to do is not impossible, and I have probably not told you exactly how to accomplish it because the import may be wrong. What you want to do is prone to error if you forget to clean up after your changes.

_________________
I ate your Death Knell.
The Traipse Movement
Please show your support for Traipse OpenRPG http://www.facebook.com/MadMathLabs
Send me Traipse OpenRPG Ideas, Bugs, Complaints, Praises here: https://getsatisfaction.com/mml


Wed Mar 17, 2010 1:37 am
Profile YIM WWW

Joined: Thu Dec 10, 2009 6:37 am
Posts: 335
Post Re: Help writing star wars dieroller
By an odd coincidence digitalxero has been simplifying the die roller recently with the last three checkins:

http://trac-hg.assembla.com/openrpg_dev/timeline

By e-mail he's been explaining it a bit (reposted below):

the way I designed the new roller system, people can easily write
their own parser for the text between the brackets. I wrote the parser
so that it works with all current rollers, but there is no lock in to
that particular parser.

Each roller has 3 default override options. The format_string, which
determines the layout of the roll output. A fudge_roll methods that
gets called for #dF rolls so custom rollers can change the value of F.
and a build_extra method that is called so the roller can add extra
info to the output, like the d20 .attack method does.

To write the custom WEG Star Wars roller it would take a little more
as the data coming in would not be in standard format, but you could
override the __call__ method that receives the roll_string. For this
particular roller I wold make it a sub class of the Standard roller,
try to parse the roll_string with the default parser and catch the
parse exception then use a custom parser to transform it back into
standard format instead of shortcut format then continue with parsing
as normal.

Also if Custom dice roller writers are feeling very Ambitious they can
write their own BNF (http://en.wikipedia.org/wiki/Backus-Naur_form)
that fits their micro language. The new roller system includes
pyParsing which is what I used to write the BNF for the current
parser.

-------------------------------------------------

So you could look into that. His email is digitalxero and then at gmail.com

This would be on the "1.8.0.+ developer" version which has a bunch of other features I've been adding over the last six months. It's probably time for a new release really. Anyway if you have mercurial installed (I think it comes with openrpg 1.8) then you can download it by typing the following into a CMD prompt:

Code:
hg clone http://hg.assembla.com/openrpg_dev


That will create a directory called openrpg_dev with all the usual openrpg file directories and should work right away without interfering with other installations.


Wed Mar 17, 2010 4:22 am
Profile
User avatar

Joined: Wed Dec 09, 2009 9:39 pm
Posts: 712
Post Re: Help writing star wars dieroller
:o :shock:

I am in awe at how much was added.

_________________
I ate your Death Knell.
The Traipse Movement
Please show your support for Traipse OpenRPG http://www.facebook.com/MadMathLabs
Send me Traipse OpenRPG Ideas, Bugs, Complaints, Praises here: https://getsatisfaction.com/mml


Wed Mar 17, 2010 5:25 am
Profile YIM WWW

Joined: Thu Dec 10, 2009 6:37 am
Posts: 335
Post Re: Help writing star wars dieroller
I would think the Backus-Naur stuff would be something you'd like?
I still haven't had a chance to look at it properly. My wife has me trying to fix her printer.


Wed Mar 17, 2010 1:53 pm
Profile
User avatar

Joined: Wed Dec 09, 2009 9:39 pm
Posts: 712
Post Re: Help writing star wars dieroller
It is .. but that is so much that is being added, and the die roller is a pretty simple design. I think it could be done with a smaller footprint. Dude .. all we are doing is picking a random number and then evaluation math. Only the special functions need extra special coding.

Ah well. I await to see what comes of it.

_________________
I ate your Death Knell.
The Traipse Movement
Please show your support for Traipse OpenRPG http://www.facebook.com/MadMathLabs
Send me Traipse OpenRPG Ideas, Bugs, Complaints, Praises here: https://getsatisfaction.com/mml


Wed Mar 17, 2010 3:24 pm
Profile YIM WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2


Who is online

Users browsing this forum: No registered users and 138 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.