Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: searching on script language := keeled over StakFallT  (Read 466 times)
StakFallT
Community Member
*
Posts: 127


« on: May 14, 2008, 04:03:07 PM »

Ok hopefully this hasn't been asked, I know from a quick search and glance, through some of the forum search results, that the topic has been tap-danced around. And for roughly 3 days on and off I've search for various combinations to the answer to my question, er rather dilemma. The yahoo three-day search bit wore me out. It trampled me, overwhelmed me with far more info than I needed and made me keel over. So I'm putting this out as a plea for some guiding direction in sorta a last ditch effort Smiley

My dilemma: I need a script language that has these features:
1) Can run multiple things at once, I guess multi-threading, or as (I think) Python calls it, CoRoutines
2) Can call functions and procedures that are in my Delphi code, from the script. In other words I need something that a script can call a function or procedure I've written in Delphi.
  • Side note about 2: Almost everywhere do websites talk about the other way around (Delphi calling functions of the script language). My thoughts are why in the world would you use a scripting language in an application when everything can much more easily be done in code. I don't understand it. In a game it makes sense, because multiple events can (and usually) occur at the same time, so a scripting language in a game arena is far more meaningful (At least from what I can tell. I dunno maybe something in packet events like some web code or something maybe it might be useful..?...).

3) Must be able to register events, like in LUA
4) Must be usable in Delphi
5) My last note is definitely of the preferred type but obviously not required. I'd like it to be platform independent. Granted TV3D uses DX and hence isn't platform independent itself but I'd rather make as much code platform independent as possible. Call it an OCD quirk or something I guess..

Some of my general concerns:
I did find something that satisfies most of these, and that's Pascal Script but I don't know if you can register events in it like you can in LUA, and from what I've seen you have to compile the script, there's no just running it, which if multiple objects in the game world has scripts and events (inside those scripts) attached to them, I don't know how the whole compile thing will work out. It sounds to me like an array of Pascal Script objects, which all I gotta say is WOW that sounds like -alot- of memory consumption. So I'd rather plan ahead than possibly open-heart surgery my code and find out it doesn't do what I need it to lol I'd prefer to use LUA since I know Blizzard's using it for WoW (And I'm familiar with LUA from coding mods for WoW) which means they are successfully using it (kinda like it being pre-field-tested for me  Grin ) and I know it registers events and will likely do everything I need it to do, but from what I've seen it's next to impossible to get it to integrate (at least the way I'd like it to: see point 2) with Delphi.

Two additional questions taken out of the above paragraph
1) Can you register events with Pascal Script?
2) Does anyone have any tutorials showing how to register events with Pascal Script?
3) If you cannot register events with Pascal Script, does anyone have any examples of integrating LUA with Delphi for the purpose of point 2?

Thanks in advance for reading and any help is seriously appreciated!
-- StakFallT

Logged
lichtkante
Community Member
*
Posts: 29


« Reply #1 on: May 15, 2008, 10:07:32 AM »

1) Can you register events with Pascal Script?

I'm not shure if i really get the point, but as far as i know there is an Importer Executable in (REM Objects?) PascalScript, that imports Delphi Units / Classes for the use within the script.
Logged
StakFallT
Community Member
*
Posts: 127


« Reply #2 on: May 15, 2008, 04:22:54 PM »

Well that's not the "register events" thing I was referring to, though what you did refer to was a point I needed satisfied as from what I've seen Pascal Script will do what I need it to, with the exception of one possible thing. Events.

I'd like to tell pascal script something along the lines of "should event'talk_to_npc' occur, run such_and_such function (written in pascal script)" and then when a key is pressed (in my game's actual delphi code) fire off a "talk_to_npc" event to pascal script (if a hotkey was hit and it equals the talk_to_npc button). I'll rewrite this if it doesn't make sense still. I think it should though. Any ideas?

-- StakFallT
Logged
lichtkante
Community Member
*
Posts: 29


« Reply #3 on: May 17, 2008, 08:16:23 AM »

Sorry, i think i cant help you,
i played around with pascal script for a while, but i had problemes understanding everything ... right now i am using DBasic for scripting, but there is no OOP.

I am just executing a script, when a Talk_To_NPC Butoon is clicked in Delphi / TV or an ItemMesh is picked with the mouse. The script itself reacts and calls some Delphi Functions to get the NPC Talking. Thats easy possible there and should be possible in PascalScript, too. 

If this is not what are you looking for , then i completely miss something Smiley Sorry, i am a hobbyist  Roll Eyes

Anyway, i would be glad to here from you, if you get PascalScript running for your needs ...

Greets

EDIT ; Did you take a look at Lua for Delphi ? I think i will ... maybe LUA is able to suit your needs
http://www.pascalgamedevelopment.com/viewtopic.php?t=4805&postdays=0&postorder=asc&highlight=lua&start=15&sid=134513d2323e7b8a7f1a01467d3b0e1e
« Last Edit: May 17, 2008, 08:36:42 AM by lichtkante » Logged
StakFallT
Community Member
*
Posts: 127


« Reply #4 on: May 17, 2008, 06:48:51 PM »

Well I did get Pascal Script to work, and by work I mean create a Delphi function in my source, and call that function from inside the script. Problem comes in, it was EXTREMELY convoluted, like the "imports" example, that comes with it, had two different objects to allow this (Allowing usage of source functions in scripts) to happen. It had one as a compiler, and another as a debugger. A few odd things I noticed (aside from the enormous amounts of code they had just to make it fly):
1) There was this OnUses function that I could not figure out what it's purpose was, but it was 1 of 2 places exporting was occurring
2) Why does the debugger object (in the 2 of 2 places) export the functions, not the script_compiler object
3) Why so freaking much code just to make something, that seems the obvious reason to use a script language, work?

Bottom line, it does probably 2/5 of what it needs to, but 1) I don't know how fast it is, 2) you can't register events from what I see (which means any and all game logic would have to be coded into the main render loop or branched out from the main render loop.. messy...) and 3) Based on how much code is needed just to export usage of source functions to the source, I'd just as well say it doesn't do it (even though technically speaking it does handle it).

Now I imagine you can do like some sort of switch/case even block in the scripts, but that's not exactly the same as registering an event because with a switch/case that means you have to run and re-run the script over and over again.. ech.. And if everything in the scene is destructible (To an extent) (like in GTA) can you say speed issues? lol

Here's another problem I was thinking, and this is probably going to be across the board for script languages (that I think is more of a implementation issue than a language issue): If each mesh/actor has a script attached to it that means either A) You need duplicate script objects for every mesh/actor that's in the scene that has a script attached to it, or B) You need a script language that has built-in multi-script kernels (kernel proper word for this??) And lets put it this way, if it's scenario A then that would make a game nice and slow lol And fact is, a script language that has to compile it's script before it runs, most likely won't work due to all the crap that goes into just compiling the thing, unless it's painless that is.. I'm looking into the LUA for Delphi, (I'd REALLY love to use LUA) but they're throwing around ALOT of temrinology (things like Indexers and UnhandledReaders and UnhandledWriters) that's over my head. And I'm not sure I want to understand the terminology until I know for a fact exporting usage of delphi functions to lua is possible (I'm pretty sure it is for C++)...

I'll definitely post back if I can find something though...

-- StakFallT
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks