Paradoxs wrote:Events
Prime will still have events in the next release, but I am debating removing them entirely, feedback would be helpful in the making of this decision.
By events you mean "onCurioFind()", for example? If so, why would you do it?
Paradoxs wrote:Events
Prime will still have events in the next release, but I am debating removing them entirely, feedback would be helpful in the making of this decision.
lacucaracha wrote:Paradoxs wrote:Events
Prime will still have events in the next release, but I am debating removing them entirely, feedback would be helpful in the making of this decision.
By events you mean "onCurioFind()", for example? If so, why would you do it?
Paradoxs wrote:lacucaracha wrote:Paradoxs wrote:Events
Prime will still have events in the next release, but I am debating removing them entirely, feedback would be helpful in the making of this decision.
By events you mean "onCurioFind()", for example? If so, why would you do it?
Because it forces a task to be made and checked. You usually have one or the other.Instead of OnCurioFound(); (Which only fires once per object I believe, still looking into that) You would have scanForCurios(); which would return a list of map objects that are curiosities. with their location on the map.
I havent decided on removing it yet, and if people really want me to keep it I'll make Prime check the script for what events your looking for and only firing those events.
lacucaracha wrote:
Hmm, i see. But that would cause some problems, cause we would have to always call scanForPlayers() to check if there are new players on the screen, and not a single method doing it.
The code would look much worse, and maybe even less eficient.
function wait(Miliseconds){
if(ScanForPlayers())
FoundPlayerFunctionYouMade();
if(ScanForAnimals())
FoundAnimalFunctionYouMade();
sleep(MiliSeconds);
Paradoxs wrote:lacucaracha wrote:
Hmm, i see. But that would cause some problems, cause we would have to always call scanForPlayers() to check if there are new players on the screen, and not a single method doing it.
The code would look much worse, and maybe even less eficient.
Right now as it stands though if I have a script that wont complete the main function until it reaches the Docks for example or a mining spot, it wont check for new players at all. They will have been added to a task and that task will be ran just before the main call. Giving functions in my eyes gives you complete control over your script, you could replace sleep with:
- Code: Select all
function wait(Miliseconds){
if(ScanForPlayers())
FoundPlayerFunctionYouMade();
if(ScanForAnimals())
FoundAnimalFunctionYouMade();
sleep(MiliSeconds);
But like i said, I won't remove them completely unless no one seems to mind, I will be adding generic Scanning Functions that do the job the events do normally. I'll just have prime do a quick scan for OnCurio() and what not so that they can be ignored if you want and used if you want.
LostJustice wrote:Paradoxs wrote:lacucaracha wrote:
Hmm, i see. But that would cause some problems, cause we would have to always call scanForPlayers() to check if there are new players on the screen, and not a single method doing it.
The code would look much worse, and maybe even less eficient.
Right now as it stands though if I have a script that wont complete the main function until it reaches the Docks for example or a mining spot, it wont check for new players at all. They will have been added to a task and that task will be ran just before the main call. Giving functions in my eyes gives you complete control over your script, you could replace sleep with:
- Code: Select all
function wait(Miliseconds){
if(ScanForPlayers())
FoundPlayerFunctionYouMade();
if(ScanForAnimals())
FoundAnimalFunctionYouMade();
sleep(MiliSeconds);
But like i said, I won't remove them completely unless no one seems to mind, I will be adding generic Scanning Functions that do the job the events do normally. I'll just have prime do a quick scan for OnCurio() and what not so that they can be ignored if you want and used if you want.
I currently get all map objects and iterate through them, do said action, and then remove the list. Then rinse and repeat. I do not even use the event system because it does occur once per object. I wouldn't mind a scan implementation because that is basically what I use right now and seems to be highly efficient. Also if you need a programming perspective, the game window is consistently updating causing changes which need to be accounted for. Events only fire if a condition has happened but not twice and not if the condition is still a threat (aka a hostile creature or player). I am all for the scan method only if you have a way to get a list of objects by name though or id or w/e.
Paradoxs wrote:LostJustice wrote:Paradoxs wrote: ~Snip.
I currently get all map objects and iterate through them, do said action, and then remove the list. Then rinse and repeat. I do not even use the event system because it does occur once per object. I wouldn't mind a scan implementation because that is basically what I use right now and seems to be highly efficient. Also if you need a programming perspective, the game window is consistently updating causing changes which need to be accounted for. Events only fire if a condition has happened but not twice and not if the condition is still a threat (aka a hostile creature or player). I am all for the scan method only if you have a way to get a list of objects by name though or id or w/e.
Don't worry that is certainly a feature. the new implementation of how Prime handles itself should also make things a bit easier. The next update changes quite a bit concerning functions but will set the staple for how functions will be running from here on out. Namely functions now return javascript objects, and "all" will now return false instead of systems where -1 = false and junk like we have now. (All in quotes because I'm sure I missed a one or two)
The scan function and the state of events wont be decided for a little bit, but you are right, the fact that seeing say, an enemy player one makes you go blind to them forever is exactly the problem I have with the event system in the first place, and I dont think there is an easy way to fix it.
function findHostileCreatures()
{
var mapObjects = Game.getAllMapObjects();
for (i = 0; i < mapObjects.length; i++) {
if(mapObjects[i].name == 'bear' || mapObjects[i].name == 'lynx' || mapObjects[i].name == 'badger' || mapObjects[i].name == 'boar' || mapObjects[i].name == 'palisadeseg')
{
java.lang.System.out.print("Found a hostile creature!!\n");
java.lang.System.out.print("Adding it to the list of creatures!\n");
creatureList.push(mapObjects[i]);
java.lang.System.out.print("Creature List Length is now: "+creatureList.length+"\n");
}
}
}
var List = getMapObjects();
var list2 = getMapObjects();
if(list.equals(list2))
print("We are equal!");
loadLib("test.js");
loadLib("Examples/TestLib.js");
print(getItem()[0].FullName);
print(getMapObject()[0].Name);
print(getAttention().Total);
print(getHealth().HHP);
sendChat("Hey bessie");
var Map = getMapObjects();
LostJustice wrote:I like the update. Definitely a thumbs up for it. Updated my script and things are working a lot better now.
print(getAttention());
[object object]
Users browsing this forum: Ahrefs [Bot], Claude [Bot] and 379 guests