[Ironpython-users] Gradually executing a python script

Jesper Taxbøl jesper at taxboel.dk
Mon Jul 23 17:05:02 CEST 2012


Would that allow me to step gradually through a loop?

like:

x = 0
while x < 10:
   dostuff()
   x=x+1
while x > 0:
   dootherstuff()
   x=x-1




2012/7/23 Kevin Hazzard <wkhazzard at gmail.com>

> Why don't you use a scripting host and inject commands into a ScriptEngine
> reusing a ScriptScope as you need to execute them?
>
> Kevin
>
> On Mon, Jul 23, 2012 at 5:31 AM, Jesper Taxbøl <jesper at taxboel.dk> wrote:
>
>> Hi,
>>
>> I am not that familiar with Ironpython yet, but I have a question that I
>> hope you can help me answer.
>>
>> I am working on a programming-game where I will allow users to do some
>> simple python scripting against a simple API that I will control a game
>> character. Instructions like move and shoot etc, alongside some simple
>> sense functions that return info on the game world.
>>
>> My current prototype creates an ironpython engine for each game character
>> and executes the script in a thread by itself, which sort of works. But I
>> have the problem that the outcome of executing the game gives different
>> results every time. Therefore I would like to ask the question:
>>
>> Is it possible to execute a script inside the Ironpython engine gradually?
>>
>> I imagine that I could update a list of engines with a tick(int cycles)
>> and get a fair sharing of resources between engines and ensure the same
>> result every time.
>>
>> Kind regards
>>
>> Tax
>>
>>
>> P.S:
>> As this is a programming game I would also like to be able to limit the
>> available memory each script is using. Is there a way to limit this, so a
>> script like this would be killed.
>>
>> x = 0
>> v = {}
>> while True:
>>    v[x]=x
>>    x= x + 1
>>
>>
>>
>> _______________________________________________
>> Ironpython-users mailing list
>> Ironpython-users at python.org
>> http://mail.python.org/mailman/listinfo/ironpython-users
>>
>>
>
>
> --
> *W. Kevin Hazzard*
> Consultant, Author, Teacher, Microsoft MVP
> (804) 928-3444
> book <http://manning.com/hazzard> | mvp<https://mvp.support.microsoft.com/profile/Kevin.Hazzard>|
> twitter <http://twitter.com/#!/KevinHazzard> | facebook<http://www.facebook.com/wkhazzard>|
> linkedin <http://www.linkedin.com/in/kevinhazzard> | captech<http://captechconsulting.com>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20120723/02146892/attachment.html>


More information about the Ironpython-users mailing list