[Ironpython-users] Gradually executing a python script

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


Sorry for the spam, but the reason is that I am interrested is that I aim
to run my avatar's "ai" in a script like this:

while True:
   shoot == (sense == True)

Where the gameworld writes to the variable sense and reads from shoot.

The script will run forever and therefore needs to be updated gradually on
a lower level than script.

Kind regards and thanx for your time :)

Tax



 where I read and write to

2012/7/23 Jesper Taxbøl <jesper at taxboel.dk>

> 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/a72996d6/attachment.html>


More information about the Ironpython-users mailing list