Copy/Paste in 3.3.0 broken?

Started by MillsJROSS, Mon 01/09/2014 18:46:31

Previous topic - Next topic

MillsJROSS

Pasting does not appear to be working in the newest AGS.

  • I upgraded today and I noticed that the paste shortcut and menu options are not working.
  • The copy is working...I'm able to paste code external to the AGS editor.
  • I'm on a Windows 8 machine. I've uninstalled and re-installed to see if that would fix it, but I'm getting the same issue. I've tried moving back to the older version, but now that I've saved my game in 3.3 there's nothing I can do.

-MillsJROSS

Weilard

I have same problem. In case when I type code - all works fine. In case if I'm paste same code (absolutely same) from clipboard function... I haven't see results of my work in the game. My operational system is Windows 7. Version of engine is - AGS Editor .NET (Build 3.4.0.12), v3.4.0, September 2016

function room_FirstLoad()
{
oForeground.SetView(VBEACH1);
oForeground.Animate(0, 5, eRepeat, eNoBlock);
}

I spent half of the day (sorry, i'm not a coder, just artist) to understand what's wrong with this code. Why in the first sceen of my game all works fine, but on the second screen same code isn't work. Answer is - copy/paste. When I type same code manually all start to work. Honestly I can't understand what is this. Maybe I am cursed? Now I can see that i'm not mad.

Crimson Wizard

#2
I do not think your problem is same as original poster (MillsJROSS) had. MillsJROSS had a problem with paste not working at all, like not being able to paste the text in script window.

Regarding your issue, do you actually link the function you paste to room events? You need to open room's properties, events tab (the "lightning" icon) and put function name into corresponding event entry to make it be called by your game.


Weilard

#3
Yes. I'm link event with room. I make a cloning of my previois operation when all works fine. Insead of one case. Where I put code into clipboard, and paste it.
When I'm try to use different functions of room to call start the event - never happening. Until time when I repeat this code by my hands. Only after this animations start working. I don't know why is happening. Have no idea I can describe normally. I mean... on the correct version of english language.

Thank you for quick answer. As I understand original man who made the post have different problem. Sorry for non-understading or wrong understnding.

Gilbert

One possible mistake one may make when copy/pasting functions, is that by typing manually the function's name to link it to events there can be slight typos. Note that the script language is case sensitive, so if the function's name is room_FirstLoad() in the script and one types Room_FirstLoad() to link from an event it won't work.

If you start from scratch to add a function to an event the editor will automatically generate the (empty) function in the script, which should always work as it's free of such typos.

So, one advice in copy/pasting functions is, do not copy the whole function but only its content (i.e. without the declaration line function xxxx(){ and the last }). You can then generate the empty function in the destination event and then paste the copied stuff inside the function body.

Weilard

Thanks for good advice. I use it. I'm also little bit scared about register. In many examples of code in network people write names of objects and other important names differently, like:

oPurseOfGold
oPURSEOFGOLD
opurseofgold


And I mentioned that at least Views sensitive to this. What can you advice in this case? Sorry for offtopic. We can erase my questions and answers after to save clearness of forum.

Crimson Wizard

Unless you made a typo or used wrong letter case, as Gilbert suggested above, the only thing that comes to my mind is that Editor may not detect that script was changed when you paste text in, and does not rebuild the room. If nothing else works, try choosing "Build" -> "Rebuild all files" in the menu. Although that is just a random guess that is not necessarily correct.

Quote from: Weilard on Thu 10/11/2016 05:47:50
Thanks for good advice. I use it. I'm also little bit scared about register. In many examples of code in network people write names of objects and other important names differently, like:

oPurseOfGold
oPURSEOFGOLD
opurseofgold


And I mentioned that at least Views sensitive to this.

ALL the script names are case-sensitive, Views, objects, characters, etc. Whether to write them in capital or small letters is up to your liking. One thing to be aware of is that AGS automatically generates some names on its own, for example, for every character it creates CHARACTERNAME variable - all in capital letters. I never tried this myself, but I would think that if you name your character in all caps, it may cause conflicts with auto constants.

Quote from: Weilard on Thu 10/11/2016 05:47:50
Sorry for offtopic. We can erase my questions and answers after to save clearness of forum.
Should not be a problem, forum moderators can split out certain posts into separate topic.

Snarky

You can do whatever you like, but it's good to be consistent and follow widespread conventions. Here's what I would recommend:

Variables in "camel case" starting with a lowercase letter: Object* oPurseOfGold, int timeCounter, bool hasPotion
Types (in AGS: structs and enums) in camel case starting with an uppercase letter: struct Incantation {...}, enum WeekDay {...}
Constants in all uppercase: #define MAX_FEATHERS 6

Weilard


SMF spam blocked by CleanTalk