MySQL Funktionen Hilfe

Yo !! I’m new in MySQL and i want to do something.
In my game i’m calculating the EXP and the level from the complete EXP. But i want to calculate the Stats depending from the Level in my Database. I know there are functions and procedures. but i don’t know what syntax to use i don’t even know how i can get changes of variables or variables in general…

in short i need an SQL code where i can catch the change of a variable and change other variables from different tables with a specified formula… i just need a dummy code so i can see what to do.

i hope you can help this would be really awesome !!

PS: I’m using MySQL if this is important.

1 Answer

1

If I understand you correctly, you want the MySQL server to tell all clients when a value changes in a table.

This was a big problem on a business application I was working on last year. My MySQL isn’t great, but as I understand it there is no real way to push changes from the database like that.

Your best bet is to have an intermediate Unity server that pushes changes to clients, and occasionally polls the database where necessary.

This is more work to implement, but actually acts as a form of load balancing and will make your game far more scalable. Furthermore, it may potentially act as an extra layer of security.

no thats not what i wanted. i mean when someone somewhere changes a value in a table the function should regognize it and change other values in it's own database. the change don't have to be recognized the point is that it's there and changes other values i just want the server to do work i don't want to do in my program with SQL commands because the more i do in my program the slower it is. because its a free server i'm using its not the fastest ^-^

–

I'm afraid that doesn't really clarify what you are trying to accomplish.. I assume your current setup is something along the lines of: 1. Game instance that communicates with http server -> 2. HTTP server that uses php to send mysql requests to database -> 3. MYSQL database Could you elaborate on your setup and what you are trying to accomplish?

–

let me explain it more detailed i just want some sort of this code: kokujou_charaktere.atk = kokujou_charaktere.level * (base value); kokujou_charaktere.def = kokujou_charaktere.level * (base value); to execute everytime when the kokujou_charaktere.level changes. it can be executed for all characters... all entries in there or just for one that doesn't really matter. it doesn't even need to be on variable update i just want the atk values to be as high as the level value multiplied with a certain base value which i specify by myself you know what i need now? the question is: is this possible?

–