Aller au contenu

Photo

dood's scripts and stuff


  • Veuillez vous connecter pour répondre
36 réponses à ce sujet

#1
acomputerdood

acomputerdood
  • Members
  • 219 messages
 just wanted to re-post some of my nwvault submissions here to get some feedback on them.  i think they're pretty well described on the vault pages, but they're all implemented in my PW (www.dalakora.com:5121) if you want the check them out live.  in no particular order:

NWNX web spawner - my system that uses exported minimaps to spawn creatures, placeable, and items in the game from a handy cgi webpage.

NWNX web-to-game chat - a cgi chat page that allows web users to chat with players in the game.

PW map with google's API - an overland map of my PW (and instructions on how to make your own) using google maps' API.

NWNX storyteller with web submission - a simple cgi submission page for users to submit fanfiction to the database and a creature that will re-tell the stories to PCs in the game.

NWN player status page - my first foray into NWNX database and web page integration.  a simple status system to see who's logged in the game.

game log to forum posting - my perl scripts i use to parse the game's log file looking for specific entries.  the code then auto-posts to a phpBB forum automatically using curl.

Modifié par acomputerdood, 24 juin 2012 - 03:06 .


#2
Carcerian

Carcerian
  • Members
  • 1 108 messages
Interesting stuff!

Does web chat have the potential for language translation?

#3
acomputerdood

acomputerdood
  • Members
  • 219 messages

Carcerian wrote...

Interesting stuff!

Does web chat have the potential for language translation?


wow, ummmm...  never thought of that.  i'm trying to use chrome's "right click -> translate to english" and it seems to be hanging.  i also tried translate.google.com, and it kind of worked but choked after i entered my chat name.

i have a feeling that neither one of those are going to work.


though the code is modular enough that you could shim in a function to translate the text that's pulled from the database before it's presented to the web client.  you could also translate text submitted from the web client before it's entered in the db, too.  that's assuming, of course, that such a module/API/whatever exists.

of course it would only work for translating text on the web end.  i'd shudder to think of using nwscript to do any translations.  but it's feasible to translate all web text into the language of your server to display in game.  all you'd need on the cgi page is a "select your language" radio button when you log in.

#4
Carcerian

Carcerian
  • Members
  • 1 108 messages
Yeah, I'd think making nwn do it all on its own would def be a performance hit for sure, but how about making an
external chat client do all the work and just echo the end result? Perhaps IRC or the like?

I know people who speak english as a second language (or not at all) would definatly have use for a "babel" system.

Ingame seamless onchat translation channeling to and from web would be most preffered obviously, tho even a simple web page as suggested would be an massive improvement for players (as you can paste translated text to nwn, but copying nwn text is sadly not an option...)

I'm suprised nobody has ever proposed web translation, it was my first thought upon seeing  your nwn-web work:)

Modifié par Carcerian, 20 juin 2012 - 03:10 .


#5
Carcerian

Carcerian
  • Members
  • 1 108 messages
*Random acts of voting* :D

Modifié par Carcerian, 20 juin 2012 - 03:13 .


#6
nwnsmith

nwnsmith
  • Members
  • 67 messages
Interesting body of work. I am light on the php side but I will try and implement these over the next week or two.

#7
acomputerdood

acomputerdood
  • Members
  • 219 messages

nwnsmith wrote...

Interesting body of work. I am light on the php side but I will try and implement these over the next week or two.


let me know if you need any help!

#8
acomputerdood

acomputerdood
  • Members
  • 219 messages

Carcerian wrote...

I know people who speak english as a second language (or not at all) would definatly have use for a "babel" system.


the web does not fail - there is a perl module to use google's babelfish to translate text:
http://search.cpan.o...16/Babelfish.pm

i would suggest keeping the database (that nwn reads) in the language of the server (to save you from translating in the game).  then you can just shim in the $obj->translate call each time you read from or write to the database from the web client(s).

as i mentioned earlier, just have some radio buttons on the login page to select the language you want.


and now that i'm thinking about it, i wonder if there's a way to translate text in the game using the nwnx chat plugin.  hmmmm......

if the chat plugin can enter each text spoken into the db, then you can set up a mysql trigger to fire on INSERT (http://forums.mysql....7815#msg-257815) which can call a perl (or whatever) script to translate it to whatever language you want and insert it back in the db.  your original chat plugin script should then have a delayed read (1 second?) to read the newly translated text back out of the db and speak it to the specific players.

sounds a little crazy, but it might just work!  all chats would be delayed 1 second (maybe more, maybe less) but it should be doable with a bit of hard work.

#9
WebShaman

WebShaman
  • Members
  • 913 messages
I really, REALLY like your work here!

Thanks for posting it!

This is really awesome sauce! I expect that it is also accessable due to the website via Smartphone, right?

#10
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<mapping his...>

Oh! My! I completely missed the mapping tute! I *really* like!

Thank you for posting this, ACD.

If there are other under-appreciated contributors out there <and we know there are>
*please* promote your stuff like this. Data-mining the vault is problematical at best, while scanning the forums for new posts is part of my morning wake-up =)

<...ikkle head off ;-)>

#11
acomputerdood

acomputerdood
  • Members
  • 219 messages

WebShaman wrote...

This is really awesome sauce! I expect that it is also accessable due to the website via Smartphone, right?



everything is written in perl/cgi with maybe a bit of javascript (i'm a little old-skool), so i see no reason why a smartphone couldn't handle it.

the webspawner, of course might be difficult because you have to click on the right spot on the maps.  that would depend on your screen size, how much you could zoom, and a stylus would probably help.

i see no reason why the webchat wouldn't work, though.

Modifié par acomputerdood, 21 juin 2012 - 02:04 .


#12
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<donning his lenses...>

Do you think google's map API might be compatible with Zoomify?

If so, both your web spawner and your PW maps would get a huge bump in detail :-)
Edit: Imagine screenshots of the areas in full detail stitched together for that area map... ;-)

<...*and* the magnifying glass>

Modifié par Rolo Kipp, 21 juin 2012 - 02:19 .


#13
acomputerdood

acomputerdood
  • Members
  • 219 messages

Rolo Kipp wrote...

Do you think google's map API might be compatible with Zoomify?


i don't see much difference in zoomify's images vs. google maps.  they both seem to produce a similar effect (zoomable image/map).  the downside is that zoomify expects you to pay them something.

also, i didn't immediately seem evidence of being able to place map markers in it like i do in my google maps.

finally, i prefer the open standard because i'm a tinkerer.

If so, both your web spawner and your PW maps would get a huge bump in detail :-)
Edit: Imagine screenshots of the areas in full detail stitched together for that area map... ;-)


i'm not catching the connections you're making here.  zoomify and google maps seem to be doing the same thing.  they both take a bunch of little maps stitched together into one giant one and then cut them up (tile them) into smaller and smaller pieces.

neither one "creates" detail when it zooms in.  to get more detail in my maps, i'd need to start with something better than the mini-map exporter tool.  i KNOW it would be possible to somehow extract the map from the module that you see in the toolset.  i've not seen anybody attempt that, and i'm not desperate enough yet to try myself.

unfortunately for screenshots, they won't give you the overhead view of the areas (assuming you mean screenshots from the game).  i suppose i could screenshot each area in the toolset, though.  still it's not something i think is worth the effort.

what would be cool, though, would be to have screenshots from the toon's view in the game - this could give you the "street view" effect which would be absolutely amazing!  but again, creating a bot/google car to walk around the module taking screenshots and recording coordinates is a little beyond my abilities.

#14
acomputerdood

acomputerdood
  • Members
  • 219 messages

acomputerdood wrote...

the web does not fail - there is a perl module to use google's babelfish to translate text:
http://search.cpan.o...16/Babelfish.pm



i started some work on this and identified the areas i'd need to add the translation function to.  it really wouldn't be that hard.  as i was coding it up, i noticed in the TOS that you're not supposed to be using scripts and stuff to use their services.

i realized i was polling the db every second to grab messages, and thought they would quickly get annoyed with me for hitting their translation page that often.  so i abandoned that effort.

there is still hope for the project though.  there are some offline translation programs that would easily provide the same results.

#15
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<making a deal...>

acomputerdood wrote...
i don't see much difference in zoomify's images vs. google maps.  they both seem to produce a similar effect (zoomable image/map).  the downside is that zoomify expects you to pay them something.

Hmmm... the main selling point of Zoomify is to take a very high resolution image and present it at variable resolution levels. And they do have a free package... Holy moly! Zoomify express has been hidden :-P Guess they want to sell product...

Edit: Zoomify Express Map example...

also, i didn't immediately seem evidence of being able to place map markers in it like i do in my google maps.

finally, i prefer the open standard because i'm a tinkerer.

That's why I was asking if they could work together, I.e. use zoomify to deliver the image to to the map API.

i'm not catching the connections you're making here.  zoomify and google maps seem to be doing the same thing.  they both take a bunch of little maps stitched together into one giant one and then cut them up (tile them) into smaller and smaller pieces.

neither one "creates" detail when it zooms in.  to get more detail in my maps, i'd need to start with something better than the mini-map exporter tool.  i KNOW it would be possible to somehow extract the map from the module that you see in the toolset.  i've not seen anybody attempt that, and i'm not desperate enough yet to try myself.

unfortunately for screenshots, they won't give you the overhead view of the areas (assuming you mean screenshots from the game).  i suppose i could screenshot each area in the toolset, though.  still it's not something i think is worth the effort.

Does the Google Map API allow you to start with a very high resolution image and serve it out in bandwidth-friendly sections? I know their satellite images are handled this way, but can you do this with custom images? If it does, then that is the functionality I was looking for in Zoomify.

what would be cool, though, would be to have screenshots from the toon's view in the game - this could give you the "street view" effect which would be absolutely amazing!  but again, creating a bot/google car to walk around the module taking screenshots and recording coordinates is a little beyond my abilities.

Oh, yes! Or let players tag the map with screenshots from their explorations :-)

<...with the devil in the details>

Modifié par Rolo Kipp, 21 juin 2012 - 02:57 .


#16
acomputerdood

acomputerdood
  • Members
  • 219 messages

Rolo Kipp wrote...


Does the Google Map API allow you to start with a very high resolution image and serve it out in bandwidth-friendly sections? I know their satellite images are handled this way, but can you do this with custom images? If it does, then that is the functionality I was looking for in Zoomify.


yeah, that's how google does it, too.  their API is the same for the satellite images and for custom images.  actually, i had to mangle the API a bit to make it work how i wanted for my images, but it does the same high res image -> cut into little pieces -> serve only those out that are needed thing.

Oh, yes! Or let players tag the map with screenshots from their explorations :-)


that functionality is already 90% there.  those little bubble baloons you see when you click on a blue maker can support images, videos, whatever.  it's basically its own little html iframe.  i would just have to implement the functionality and give them a "file upload" box.  then likely help them format the entry or something.

heck, they could have a tiny little wordpress page they could edit and then upload into there.  that might be the friendliest way to do it.  the easiest of course would be to only let them upload a .png with a caption.

Modifié par acomputerdood, 21 juin 2012 - 03:33 .


#17
WebShaman

WebShaman
  • Members
  • 913 messages
What an awesome feature for any PW!

Thanks for this!

#18
acomputerdood

acomputerdood
  • Members
  • 219 messages

acomputerdood wrote...

i realized i was polling the db every second to grab messages, and thought they would quickly get annoyed with me for hitting their translation page that often.  so i abandoned that effort.


i tried again and was just not getting the Babelfish perl module to work, so i tried to use WebServices::Google::Language.  that one errored out telling me to use version 2 of their translation services.  when i looked that one up, they wanted you to buy an API key from them.

so i'd say that the translation efforts on my end are done.  :(


if somebody has another client (IRC or whatever) that can take advantage of a mysql db for chatting, then by all means pick up the project.

#19
Carcerian

Carcerian
  • Members
  • 1 108 messages

acomputerdood wrote...

acomputerdood wrote...

i realized i was polling the db every second to grab messages, and thought they would quickly get annoyed with me for hitting their translation page that often.  so i abandoned that effort.


i tried again and was just not getting the Babelfish perl module to work, so i tried to use WebServices::Google::Language.  that one errored out telling me to use version 2 of their translation services.  when i looked that one up, they wanted you to buy an API key from them.

so i'd say that the translation efforts on my end are done.  :(


if somebody has another client (IRC or whatever) that can take advantage of a mysql db for chatting, then by all means pick up the project.


Thx for trying :)

Modifié par Carcerian, 22 juin 2012 - 01:10 .


#20
nwnsmith

nwnsmith
  • Members
  • 67 messages
Hey Dood, any chance of an adjusted player tracker for when your website is hosted on a different machine than your nwnx ?

#21
acomputerdood

acomputerdood
  • Members
  • 219 messages

nwnsmith wrote...

Hey Dood, any chance of an adjusted player tracker for when your website is hosted on a different machine than your nwnx ?


that's easy!  all you have to do is change the "$host" line in the cgi/perl file:

$db = "dalakora";
$host = "localhost";
$userid = "user_id";
$passwd = "user_pass";
$connectionInfo="dbi:mysql:$db;$host";


to properly reflect the location of the mysql database.  specifically, instead of "localhost" you'll have "my_nwnx_server_db_host.com" or whatever the IP/DNS name is.

Modifié par acomputerdood, 24 juin 2012 - 02:39 .


#22
lordofworms

lordofworms
  • Members
  • 252 messages
does the story submit portion work with sqlite?

#23
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
@acomputerdood - I love your stuff!  :D  Very innovative ideas.

@AnyoneAndEveryone - Hey, if anyone is still interested in playing around with real-time translation, I wanted to drop a few links and ideas which might be useful.  Years ago I wanted a way to mass translate TLK files into different languages and the programs which did the closest job were used for automatically translating .SRT, simple text files which contain timing information and subtitle text for movies or TV.  Now, there is a huge community of people who use these SRT files so there are always going to be bleeding-edge development to find new ways to get that text translated- and at least a few of those projects are open source.

Ok, so that's sort of the cornerstone of this idea.  The "in", hopefully.  While Google changed their Terms of Use for their translator, Microsoft Bing has their own translator (Terms of Use) and so some of the SRT translation projects have had to adjust.  One project which I had used in the past hasn't updated to use the Bing API, but the developer pointed to a Java wrapper for the Bing API which used Google API handles, IIRC.

And the reason I'm going the sort of circuitous route of suggesting this Java wrapper might be useful is that someone had tipped me off that MNXJ by MFX (SourceForge) could perform asychnronous activities by using a thread daemon- which would be a nice way to keep everything from getting locked up while waiting for a response from something like a translation service.

So, if anyone's still reading the idea is:
1. Rip code and techniques from SRT translation community, which is constantly updated as the situation changes
2. Use a Java wrapper for the API and something like MNXJ so the requests for real-time translation don't bog the server down during translation transactions which take any length of time to complete.

The actual mechanics of how that would be dealt with on the NWN side are sort of dealer's choice.  Whether the chat data would be stored in a db, dealt with and then shown to users when a successful translation came back for that line...or whether it would blindly send the threads out to the Java wrapper/plugin and just spam back what it received, as soon as it received it, are a matter of choice.

Aside from the translation of TLK files, I always liked the idea of something that would bring the international community a bit closer to the English-speaking one, at least on multiplayer servers.  I did proof of concept tests long ago which showed that mass translation of .TLK was possible with something like SRT translation programs but I don't have the skills (I'm not a programmer) to hook up the pieces of my idea about real-time translation to see if that would work.

I, uh, also realize this is no small amount of work.  But I've seen this idea floating around in various forms from various corners of the community and wanted to make a pitch at a solution I thought could work...and maybe someone would give it a try sometime.

Modifié par OldTimeRadio, 24 juin 2012 - 04:41 .


#24
acomputerdood

acomputerdood
  • Members
  • 219 messages

lordofworms wrote...

does the story submit portion work with sqlite?


i'm only somewhat familiar with sqlite, but i assume it should be reasonably compatible with my code.

if your nwnx and database are set up and working already, i assume all you'll need to do is check the syntax of my mysql statements to make sure they work.


i guess the tricky part would be finding a perl module that worked with sqlite for the web end.  i'd start with this one:

http://search.cpan.o...b/DBD/SQLite.pm 

and use my code and google as a template/guide to get yours up and running.

Modifié par acomputerdood, 24 juin 2012 - 05:33 .


#25
acomputerdood

acomputerdood
  • Members
  • 219 messages
it seems i just can't drop a project.....

good ideas OTR, but i (stubbornly) kept at my old chat/translation system, and figured it out. i learned how to get microsoft/bing to do my translations using curl, so i can submit the string to be translated via curl and parse the results coming back.

i still have quite a bit of work to do to clean things up, but the main problem is that i'm sure i'm still breaking their TOS by using the script. furthermore, the code pulls 10 text lines from the db every second, and right now queries for 10 translations. that's pretty unacceptable.

i'll have to add in some intelligence to "remember" the previous translations, and of course recognize that it doesn't have to translate from english to english or whatever.  it's very likely that one off applications like this will slip under the radar.

it is, of course, nothing i can't handle :D

Modifié par acomputerdood, 26 juin 2012 - 11:33 .