Have you tried "Call Common Event" event command? It's in the first tab under "Flow Control".
Ruby/RGSSx questions that don't deserve their own thread
RGSSx Script SupportThat is not a Ruby/RGSSx question. That is an event question, and belongs in the VX Ace Support forum.
Don't confuse events with scripts. They are two VERY different beasts.
Don't confuse events with scripts. They are two VERY different beasts.
hi, simple question this time, I wonder how long variables from scripts are... "alive"?
when a script is loaded and some variables are written with data, are those variables gone if the script is closed so I have to write the data every time into my variables?
when a script is loaded and some variables are written with data, are those variables gone if the script is closed so I have to write the data every time into my variables?
As long as the variable has reference to it.
Though, I'm not really sure what do you mean by "alive" and "the script is closed"
well... it is hard for me to explain in english...
lets say.. I open a scene, this scene has variables and I write data into the variables. then the script do some stuff and I close the scene. are the data in the variables stored even the scene is closed and the script is not running or are they gone when I close the scene?
lets say.. I open a scene, this scene has variables and I write data into the variables. then the script do some stuff and I close the scene. are the data in the variables stored even the scene is closed and the script is not running or are they gone when I close the scene?
Any instance variables will be gone once the instance object itself loses the reference. So yes, when you lost reference to the scene, the instance variable disposed automatically. Let me give you an example
class YourObject def initialize @data = 123 endend$obj = YourObject.new# @data is 'alive'$obj = nil# @data will be goneHowever, if you're using RMVXAce, it sometimes uses @stack to stack some scenes using SceneManager.call(Scene_Class). So you wont lost the reference to the scene object and the variable may continue to 'alive'. But when you're using SceneManager.goto(Scene_Class) then the previous scene will be gone as well as its instance variables.
Note that this doesn't include any Graphical related class like Window, Sprite, Plane and Viewport. You need explicitly dispose the object by using dispose method.
class YourObject def initialize @data = 123 endend$obj = YourObject.new# @data is 'alive'$obj = nil# @data will be goneHowever, if you're using RMVXAce, it sometimes uses @stack to stack some scenes using SceneManager.call(Scene_Class). So you wont lost the reference to the scene object and the variable may continue to 'alive'. But when you're using SceneManager.goto(Scene_Class) then the previous scene will be gone as well as its instance variables.
Note that this doesn't include any Graphical related class like Window, Sprite, Plane and Viewport. You need explicitly dispose the object by using dispose method.
ah okay, thanks you! =)
I was wondering if I have to write a large amount everytime or just once while the game holds the data.
so its better to do it everytime! ^^
I was wondering if I have to write a large amount everytime or just once while the game holds the data.
so its better to do it everytime! ^^
well, I run into another problem.
in my script at a certain point I want to remove a skill from the actor and add another.
adding the skill just works fine with $game_actors.learn_skill(skill_id)
but the actor doesn't forget the skill!!
I tried it with:
$game_actors.forget_skill(skill_id)and$game_actors.skills.delete(skill_id)but nothing of both works... did I miss something??
in my script at a certain point I want to remove a skill from the actor and add another.
adding the skill just works fine with $game_actors.learn_skill(skill_id)
but the actor doesn't forget the skill!!
I tried it with:
$game_actors.forget_skill(skill_id)and$game_actors.skills.delete(skill_id)but nothing of both works... did I miss something??
The calls '$game_actors[id].learn_skill(id)' and '$game_actors[id].forget_skill(id)' are working fine.
I suggest you look into your script and check for the actor ID you get when the skill was removed. If that is not the correct one, you will, obviously, not forget the skill.
Also if you add the actor after you have removed a skill and if you check the 'Initialize' option for the add actor command, the list of the learned skills will be the same what you have set up in the database, regardless if you have removed or changed a skill from the list previously in the game or not.
I suggest you look into your script and check for the actor ID you get when the skill was removed. If that is not the correct one, you will, obviously, not forget the skill.
Also if you add the actor after you have removed a skill and if you check the 'Initialize' option for the add actor command, the list of the learned skills will be the same what you have set up in the database, regardless if you have removed or changed a skill from the list previously in the game or not.
I found it!!! in the database I give the actor the skill I wanted to removed.
I thought to set up the actors skills (not in the classes, they are empty in my project) was there to tell the game, which skills the actor should know at beginning of the game and not that they will always be there! oO
my bad...
learned skills and those that are added via features are saved on different lists... To delete a skill added by a feature, you need to remove the feature itself. At least I think that was how it works.
Is it wrong to disguise an 'adult web address' as an array of letter's ordinal value's and then allow that array to be joined with each char being returned to normal for processing and subsequently, loading the aforementioned web page, even if I have stated that the script in question should be used only by adults.. ??
Kind of morals / scripting based question ^_^
Kind of morals / scripting based question ^_^
I mean, it's wrong from a programming point of view, because it's entirely pointless. What is happening between it being an array of numbers and it being joined?
Someone obviously thinks it's wrong somewhere down the line, otherwise you wouldn't have to store it as an array with ordinal values, and you'd just openly pass along the string.
Someone obviously thinks it's wrong somewhere down the line, otherwise you wouldn't have to store it as an array with ordinal values, and you'd just openly pass along the string.
Why would you do it? If you indicate that the script should only be used by adults, and the person using it is not an adult, your disguising it in the script is not going to stop them using the script, running it, and seeing the web page.
FeaR616, a variable lasts until it's out of scope. If you create a variable within a method and it doesn't have @ at the start, it will cease to exist when the method ends. If it has @ it will cease to exist when the object is deleted. If it has $ at the start, it is global and will cease to exist when you exit the game. If you want a variable saved from one run to another, you must find a way for it to be included in the save data. This is usually by adding it to an appropriate class that's already saved.
Also, I have a Dynamic Features script that will allow you to remove skills that have been added via features during the course of the game.
FeaR616, a variable lasts until it's out of scope. If you create a variable within a method and it doesn't have @ at the start, it will cease to exist when the method ends. If it has @ it will cease to exist when the object is deleted. If it has $ at the start, it is global and will cease to exist when you exit the game. If you want a variable saved from one run to another, you must find a way for it to be included in the save data. This is usually by adding it to an appropriate class that's already saved.
Also, I have a Dynamic Features script that will allow you to remove skills that have been added via features during the course of the game.
Or just use the $game_variables array to save the data instead of using another variable...
The idea behind 'hiding' the address was so that when they triggered that action, it would be a surprise effect. That was all. I could just as easy make it take you to a webpage of information 🙂
The reason for it being an adult web address, was because a friend suggested me to write a small script to mess with peoples computers, So I wrote this...
500.times { system("notepad") }And then the idea for autoloading adult webpages came into discussion. 😀
Not an answer, But I approve this evil deed. LOL.
Could easily enhance it a little further...
File.open("dek.txt","wb") do |file| file << "Dekita Is Awesome!!"end500.times { system "notepad dek.txt" }What gets me most, is the fact you have to close each notepad before the next one opens - make it much more annoying imo 😀
Edit:
Heres one that opens them at at once 😀
# Cool Code Belowfname = "dek.txt"File.open(fname,"wb") do |file| file << "Dekita Is Awesome!!"endmyFile = "start notepad #{fname}"666.times { system myFile }Pity they open at the same place :'(
File.open("dek.txt","wb") do |file| file << "Dekita Is Awesome!!"end500.times { system "notepad dek.txt" }What gets me most, is the fact you have to close each notepad before the next one opens - make it much more annoying imo 😀
Edit:
Heres one that opens them at at once 😀
# Cool Code Belowfname = "dek.txt"File.open(fname,"wb") do |file| file << "Dekita Is Awesome!!"endmyFile = "start notepad #{fname}"666.times { system myFile }Pity they open at the same place :'(
Nobody who can help me?
That's not really a "question that does not deserve its own thread". Please post in RGSS3 Script Requests.
Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/