Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Save and Apply (https://forums.graalonline.com/forums/showthread.php?t=76115)

Twinny 08-05-2007 03:44 AM

Save and Apply
 
When working with scripts in RC, there are times when you'd rather just edit a script and save it rather than have it save and run. This could be a nice addition to RC.

[Clarification]: Changing a script with calling the onCreated event

Inverness 08-05-2007 10:24 AM

Quote:

Originally Posted by Twinny (Post 1337480)
there are times when you'd rather just edit a script and save it rather than have it save and run.

No, not really.
:D

Twinny 08-05-2007 06:45 PM

Quote:

Originally Posted by Inverness (Post 1337552)
No, not really.
:D

I made a script on UN which, when onCreated was called, saved all the players positions, updated the gmap then warped them back to where they were. I wanted to change some of the code without calling the onCreated event :frown:

cbk1994 08-06-2007 10:21 PM

Quote:

Originally Posted by Twinny (Post 1337636)
I wanted to change some of the code without calling the onCreated event :frown:

2BAD4U

Inverness 08-06-2007 11:55 PM

ispaused = true;

Move your stuff out of the onCreated() function and have the new function check if its been run already.

Inspiration 08-07-2007 10:48 PM

Couldn't you just comment out the part of the script you did not want to run?

Horrified 08-08-2007 04:30 AM

SO MANY CHOICES.

PHP Code:

/*

These are comment brackets!

*/

//These are comment lines!

function testPlz(params//this is a function not executed on default!




DustyPorViva 08-08-2007 04:42 AM

Then everything inside the onCreated would not function for those who recieve the weapon afterwards, unless he removed the captions and saved it... thus negating the whole process. So there aren't really SO MANY CHOICES.
Only thing I can think of is moving everything outside of the onCreated() to its own function, and calling the function only when it hasn't been called before... which would involved setting something to the player(or in a DBNPC) the first time it is called and checking it, and which would also involve clearing said something if you actually NEED the onCreated() to be called for all players again.

Twinny 08-08-2007 04:58 AM

A wicked part of my script is the ability to simply press reset on the DBNPC to run the script. Makes it alot easier for the less script savvy.

Another example. You have a weapon which creates a gui when onCreated is called clientside. Instead of causing this weapon to popup the gui (causing deaths and angry players), you could just edit the code and save the script. It may be a bit more difficult for clientside though. Id would still have to be sent but not applied.

You can argue that there are many different ways to do this (like calling creategui() from a seperate weapon) but it's just an idea.

Crow 08-08-2007 11:05 AM

You could make a weapon which calls something similar to onCreated() when the weapon itself is created, so you can edit the code of the other weapons, but I have to agree, something like that would be nice ;o

Inverness 08-08-2007 12:21 PM

There is is no reason to be creating GUIs in the onCreated() section unless they're invisible or part of the HUD.

The mechanics of the script updating process don't need to be changed when its rather easy to have a workaround to some commands being called everytime onCreated() is.

For weapons on the serverside, a simple this.variable can be used since when you update weapons, the serverside variables are not cleared.

On clientside the weapon object is deleted and recreated so variables are lost, saving to the player object would be best way for this.


All times are GMT +2. The time now is 12:47 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.