Guif0DA's Recent Forum Activity

  • Ok, I really have no idea what I was doing but now it worked..

    MODs please close this topic or remove it. ty.

  • Try this:

    value=40
    name="N"+str(value)
    System.Create(name,1, 0, 0)
    newobj=eval('SOL.' + name)
    newobj.x=300[/code:1m2irun2]
    
    eval() evaluates any python string.  Now you will only have an error if there is no object named "N40".
    

    It worked!!!!!!! thank you!!

  • Hey.. Can't

    py.GetSOL("object name here")[/code:wh3tx9c3]
    instead of a object name, use:
    [code:wh3tx9c3]
    
    name=Sprite
    py.GetSOL(name)[/code:wh3tx9c3]
    
    When I do this, The game crashes.. any solution?
  • Here is a more basic example of what I'm trying to do..

    value=40
    name="N"+str(value)
    System.Create(name,1, 0, 0)[/code:3vd45ghj]
    
    if I try and use:
    [code:3vd45ghj]
    SOL.name.x=300[/code:3vd45ghj]
    
    It ill show an error[i](AttributeError:class SOL has no attribute 'name')[/i]
    and I really need to get the object with a script like that.. cuz the value changes and so the objects created.
    
    EDIT: It's NOW WORKING Thanks to R0J0hound!
    Had to use eval()
    here's how:
  • Luomu, that will work no problem. Also you can eliminate the "objref" variable and do it directly:

    System.Create('Sprite', 1, 0, 0)
    SOL.Sprite.x =300[/code:2fstjl4k]
    

    And how do I get the new created object in the condition below?

    value=40
    name="N"+str(value)
    System.Create(name,1, 0, 0)[/code:2fstjl4k]
    
    if I try and use:
    [code:2fstjl4k]
    SOL.name.x=300[/code:2fstjl4k]
    
    It ill show an error[i](AttributeError:class SOL has no attribute 'name')[/i]
    and I really need to get the object with a script like that..
  • As always, thanks scidave!

    This SOL object is py.csx plugin from lucid right?

    The Construct is crashing when I try to execute this script, what might be the problem?

     id=System.globalvar('GAME ID')
     query="""SELECT * FROM PLAYER_ITEMS WHERE PLAYER_ID = %s"""
     cursor.execute(query,(id))
    
     results=cursor.fetchall()
     for row in results:
    	value=row[1]
    	value1=row[2]
    	value2=row[3]
    	value3=row[4]
    	value4=row[5]
    	value5=row[6]
    	itemname="n"+str(value)
    	System.Create(itemname,2,value1,value2)
    	objref=py.GetSOL(itemname)
    	objref[py.SOLi].SetValue('R',value3)[/code:2garosdq]
  • Hey everyone..

    I searched for this around here and found something about the SOL object, but to be honest not sure if this is really what I'm looking for..

    I'm with a little question about accessing a newly created object using python and change their values... example..

    I have a script that creates a new sprite object..

    then I want this new sprite have the variable ('test') the value 10.

    So how do I call this object after created?

  • Hey Scidave, I think it worked, here is the code:

    user=username.Text
    
    query4="""SELECT STATUS FROM ACCOUNTS WHERE USERNAME = %s"""
    cursor.execute(query4,(user))
    
    results=cursor.fetchall()
    for row in results:
     value = row[0]
    
     Text12.SetText(str(value))
    [/code:3ukj37gj]
    
    but it doesn't work with fetchone(), only fetchall..probably because of 'for'.. don't know.. Could I get the same result using fetchone() ?
  • This while(1) from the first code means what?

    it's true?

    I'll try it with Construct and see if was what I was looking for..

    instead of print I should use SetText right?

    Also, what is the difference retrieve as python dictionaries? didn't understood what u meant by index..

  • Hey scidave, I'm trying to get simple results from the database, right now I'm executing a query and after that I use fetchone() function to get the result, but the result instead to be just a simple string like in the database, have some more digits.. I'll try to explain better with an example:

    In a database called 'TEST' there is a username called TESTER

    so I execute a query to get this username and put in a Text object in construct.

    the result instead to be just "TESTER" is "('TESTER,')" so after the results I need to remove those other things with a strip function.

    Now if I get a result from a value in the database, instead to be just the value(4 for example), it comes with "(4L)"..

    so this is my question, is there any way I could just get the exact result from a database without those brackets, etc?

  • Hey Scidave.. do u have any idea to how make only be possible to use Letters and numbers in a editbox checking with a python script?

    tryed using strspn(Editbox.Text, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890")

    not even sure if 'strspn' exists in python..

    I need to discover the exact string method.. so I could try:

    if editbox.text contains only letters and/or numbers it would be okay.

    then if the editbox.text have a symbol letter like '%' or '&' it will inform you that it's incorrect.

    EDIT: I did ;D

    used the strip function to compare with the result

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey scidave thanks as always for your replies

    So.. just before I made that last post I discovered that was the GRANT thing.. I made another acc just for clients to access remotely and with few privileges.. today I tested it with my friend and it all worked! ;D

    the problem was that the acc I used to them access was the root one and this acc can only be used localy, from my PC only.. so I made a new one that could be accessed anywhere by adding a % at host

Guif0DA's avatar

Guif0DA

Member since 5 Dec, 2010

None one is following Guif0DA yet!

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies