Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - anarchist

Pages: [1] 2 3 ... 15
1
I don't know of a way you can achieve this in Wintermute. For such tasks though, I usually use a very nice feature of Notepad++ (https://notepad-plus-plus.org/) which is called "Find in files". You can give it the name of the variable, the folder in which to search and even the extensions of the files you want to search into and it will tell you where the variable is used.

2
Lets take one of the scripts you showed as example and modify it. I will add comments in the code, please read carefully and understand what we are doing, DO NOT simply copy paste the code.

Code: WME Script
  1. //These are the STARTING POSITIONS of your entities
  2. treebg1.X = 0;
  3. treebg2.X = 100;
  4.  
  5. var amountOfLoops = 5000;
  6. var loopsSoFar = 0;
  7. //This is the maximum X coordinate for ALL your entities.
  8. //More specifically, this is the "edge" of your screen on the right.
  9. //Whenever an entity reaches this X coordinate, you move it to the
  10. //FAR LEFT (meaning X = 0).
  11. var maximumX = 1200;
  12.  
  13. //We will perform 5000 loops.
  14. while(loopsSoFar < amountOfLoops)
  15. {
  16.         treebg1.X = treebg1.X + 1;
  17.         if(treebg1.X == maximumX)
  18.         {
  19.                 treebg1.X = 0; //Move this tree to the far left.
  20.         }
  21.        
  22.         treebg2.X = treebg2.X + 1;
  23.         if(treebg2.X == maximumX)
  24.         {
  25.                 treebg2.X = 0; //See here? We move the tree to the FAR LEFT (X = 0), NOT to its starting coordinate!
  26.         }
  27.        
  28.         //etc. etc.
  29.         //You can repeat the same for all entities.
  30.         //There could be a smarter way to do this using arrays but for now try the simple version
  31.         //until you become better in programming.
  32.        
  33.         //We sleep for 10 ms and we will loop 5000 times.
  34.         //This means this whole animation will take 5000 X 10 ms, meaning 50000ms.
  35.         //You can adjust the amount of loops depending on how long you want the animation to take.
  36.         //If you adjust how long the Sleep() command takes, you will in result adjust how fast the entities move.
  37.         Sleep(10);
  38.         //Increment (add one) loops counter so that the loop ends at some point. There are other ways to do it
  39.         //i.e. catch the ESCAPE key press and change a global variable, but for now try the simple way.
  40.         loopsSoFar = loopsSoFar + 1;
  41. }
  42.  

I have not tested this code so if it produces errors let us know which errors appear, or better yet try to solve them yourself first  ;)

What I believe you were missing is that each entity, after it reaches the far right of the screen, it should move to the far left, NOT its starting position. This will work, because, even though the "max x" of each entity is the same and the far left position is always 0, each entity starts on a different X, therefore it will take each entity a different amount of time to reach the far right X coordinate.

3
Technical forum / Re: Quick Time Events
« on: January 10, 2018, 05:06:37 PM »
I haven't used Theora, but what you want to do is doable through sprites and scripts.

Say you have an actor who is running. At some point you pause and have a quick time event. You will probably have a window with a half opaque background. Somewhere on the window you can add some text to give instructions to the user. You can also add any images you want (or even buttons if you want to go with that methodology).

On the window's script you catch left and right click events. Depending on what the user clicks, you either play the jump sprite on the actor (actor.PlayAnim('jump')) or the duck sprite (actor.PlayAnim('duck')). Any further actions can be easily scripted.

Alternatively, instead of actor you can use a sprite entity (again using PlayAnim).

This is of course a very rough description. You can ask more specific questions after you have given this some more thought. Good luck!

4
Technical forum / Re: Fix to Tru-Type Font Problem
« on: January 02, 2018, 05:18:20 PM »
Hey eborr, I would like to make a correction to your original post.

Quote
This issue appears in windows 10 and only on laptops which have physically smaller-higher resolution screens.

This issue also appears in Windows 7, Vista and 8 which also support magnification. Also, it does not happen only on laptops, but generally on high resolution monitors (PC too). Usually, icons and fonts are too small and most users choose to magnify. As I mentioned above, I have a large, high resolution monitor on my PC and the issue appears here too.

The following link might be of some help:

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dpi-related-apis-and-registry-settings

Perhaps your game can change these settings on the fly and revert when the game closes? Of course, this might cause an issue if the user closes the game using Task Manager or presses Alt+F4.

5
Technical forum / Re: Fix to Tru-Type Font Problem
« on: December 22, 2017, 02:20:59 PM »
Quote
Typically the graphic drivers which support these screens will display text at 125% of the font size. To fix the problem my solution is to create a second font directory and when you are running on one of these smaller high resolution screens you set the font attribute to files in this directory.

I am afraid this is not completely correct. The magnification of the fonts is a custom setting of Windows. Therefore, you cannot base which fonts to use on screen size or resolution. You must be able to know not only whether the user has chosen any magnification but also how much the fonts are magnified (125%, 150% etc.). Windows 10 allow up to 500% magnification (using Custom Scaling in Display Settings). For instance, I have a 27" monitor, which is why I have chosen 150% magnification.

I think the only solution is bitmap fonts because they are not enlarged by the Windows settings. We have yet to solve this issue for our game because the bitmap fonts we generated have slight imperfections.

Good luck eborr, please let us know if you find a solution.

6
Code: WME Script
  1. if(treebg2.X == 2000)
  2. {
  3.    treebg2.X=100;
  4. }
  5.  

This approach is not correct. What you want is the entities to start on the start position, move right and then, when they have reached a predefined position on the right they appear on the left. Something like this:

Code: WME Script
  1. if(treebg2.X == 1200)
  2. {
  3.    treebg2.X=0;
  4. }
  5.  

This is also problematic:

Code: WME Script
  1. while (treebg1.X<800+512 + treebg2.X<800+336)
  2.  

First of all, the + sign here 512 + treebg2.X is incorrect. You probably meant to use the "and" symbol, which for Wintermute and a lot of programming languages is this &&. I would also rethink what to use in the while() statement. You probably want this script to run for a specific duration of time, so you could probably use a counter variable. There is also no need to use a lot of Sleep() commands in the loop, just once in the end, after you have moved all the entities.

7
You have a loop (while) which moves the tree a little every few milliseconds. At some point, the tree moves way over the limits of the screen. If you leave it, it will continue to move indefinitely.

What you need to do is have an if() statement inside the while loop, which will check whether the tree has moved too much, and reset its X position to 0.

8
(1) What I did was create an empty scene and then:

In scene_init.script

Code: WME Script
  1. Game.Interactive = false;
  2. var YourWindow = Game.LoadWindow("interface\YourWindow\YourWindow.window");
  3. YourWindow.Center();
  4. Game.FadeIn(2000);
  5.  

Then, in YourWindow.script

Code: WME Script
  1. #include "scripts\base.inc"
  2. #include "scripts\keys.inc"
  3.  
  4. Game.PlayMusicChannel(0, "your_sound_file.ogg", true);
  5.  

YourWindow should be sized so that it covers the whole scene.

9
Technical forum / Re: Second actor creation and cutscene
« on: November 20, 2017, 08:37:57 PM »
Quote
What if we offer scene auto-scrolling as a tutorial for WME Knowledge base? I think this feature is quite frequent for adventure games. What do you think?

That sounds like a wonderful idea! I am afraid you will have to do it on your own though since I don't have enough time to contribute.

10
Technical forum / Re: Second actor creation and cutscene
« on: November 19, 2017, 10:39:39 PM »
Scene.ScrollSpeedX is an attribute, not a method. You get the error because you try to use it as a method:

Code: WME Script
  1. Scene.ScrollSpeedX(20); //This is wrong
  2.  

also, you have to set its value to an integer, so this is also wrong:

Code: WME Script
  1. Scene.ScrollSpeedX = true; //You assign a boolean value instead of an integer.
  2.  

a correct use would be:

Code: WME Script
  1. Scene.ScrollSpeedX = 20; //Default is 10, so this will make the scene scroll faster.
  2.  

11
Technical forum / Re: Second actor creation and cutscene
« on: November 18, 2017, 10:43:01 PM »
I don't have any special talents, I simply have been working as a professional programmer for years (and on Wintermute for some years too), which among other things gives you the ability to find solution to your problems through searching (either the documentation or the Internet in general). As you said, it is a matter of experience.  8)

Scroll speed is an attribute of the Scene object. From the documentation http://docs.dead-code.org/wme/generated/scripting_ref_scene.html:

Quote
ScrollSpeedX: Horizontal scrolling speed (in milliseconds, default=10)
ScrollSpeedY: Vertical scrolling speed (in milliseconds, default=10)
ScrollPixelsX: Horizontal scrolling shift (in pixels, default=1)
ScrollPixelsY: Vertical scrolling shift (in pixels, default=1)
OffsetX: Current horizontal scrolling offset of the scene
OffsetY: Current vertical scrolling offset of the scene

You can play with these to get what you want.

What goes around comes around. This forum helped me a lot in my game, so I am simply returning the kindness I received. Kindness breeds kindness, I am sure you will do the same some day.

12
Technical forum / Re: Second actor creation and cutscene
« on: November 18, 2017, 03:42:01 PM »
I haven't used scrolling in my scenes so I will try to help you a bit blindly.

From the documentation I can see that:

Quote
Scene.Autoscroll: Specifies whether scene automatically scrolls to the Game.MainObject

By default, in game.script you will find the following line:

Code: WME Script
  1. Game.MainObject = actor;
  2.  

So it makes sense that, when you set Game.Autoscroll = true the scene scrolls toward the main actor. Also from the documentation:

Quote
MainObject: The object which is used for the scene's auto scrolling, can be (set to) null

So it can be set to null. Perhaps this would work?

Code: WME Script
  1. Scene.ScrollTo(husband);
  2.  

After you have done the scrolling and dialogue etc. I think you will want to:

Code: WME Script
  1. Scene.AutoScroll = false;
  2. Game.MainObject = actor;
  3.  

As I said above, I am working blindly, but from what I read in the documentation, the behaviour you observe does make sense, so I think this will work.

13
Technical forum / Re: Inventory and response area always on top
« on: November 15, 2017, 04:52:01 PM »
First, since you want the inventory window to always be visible, you can completely remove the below code:

Code: WME Script
  1. // display the inventory window
  2.  

The above code is useful when you only want to display the window when the cursor moves to a particular area of the screen. But, you want it to always be visible, therefore remove the code. A programming hint: when you have if/else and they both do the same thing, you probably don't need the if/else. In your case you have an if/else if, but judging by what you want, you don't need it.

As for modifying the inventory window on the fly, take a look at the command GetInventoryWindow() to "get" the window. After you have the window in a variable, you can handle it like any other window (I have never done this so please test). I guess you can use inventoryWindow.SetImage() to change the background. I guess the same applies for responses window, where you can use Game.GetResponsesWindow().

14
Technical forum / Re: Second actor creation and cutscene
« on: November 11, 2017, 01:11:29 AM »
About the scrolling, I don't know how much you have learned so far. I haven't used scrolling in my game. I suggest that you take a look at the basics if you are not certain:

http://docs.dead-code.org/wme/inside_scenes_step1.html

Search for
Quote
OK, when we tested the scene, it didn’t scroll, right? Let’s fix it.
And make sure you follow the rules of scrolling, which is setting the main layer dimensions to be larger than the game's resolution.

Apart from that, in order for the actor to move beyond the edge and for scrolling to start, you have to extend your floor region to the whole scene. Furthermore, you can force the scene to scroll by using Scene.ScrollTo() or Scene.SkipTo().

For reference to the possible commands for each entity type, I suggest that you go to http://docs.dead-code.org/ and go to Scripting in WME -> Script language reference and always have it available for reference. I use the online documentation because I can use the Chrome's search functionality to quickly find what I want.

For Step 4 It seems you have the right idea here. Some testing will help you with the timings i.e. how much you Sleep().

Finally, for my cutscenes I used PlayAnim instead of PlayAnimAsync because, since it is a cutscene, I want the game to continue only after the animation has finished. For instace:

Code: WME Script
  1. actor1.PlayAnim('anim1');
  2. actor1.PlayAnim('anim2');
  3.  

will result to actor1 doing anim1 and after the animation is finished he does anim2. This should apply to two different actors, though I haven't tried this in my game:

Code: WME Script
  1. actor1.PlayAnim('anim1');
  2. actor2.PlayAnim('anim2');
  3.  

For new actors you can use Scene.LoadActor(). This will create actors that will appear only in this scene. From what I see, actor and sally must have been loaded in game.script, using the command Game.LoadActor() which creates actor visible in every scene.

15
Technical forum / Re: Second actor creation and cutscene
« on: November 09, 2017, 10:44:20 PM »
#2:
You have created walking regions. Maybe you have noticed that you can also create a block region (just create a region and in the options set it as Blocked). Perhaps you can create your walking region and set it up around the floor and then create two very thin horizontal blocking regions around the area you want your actor to move. I guess the area must be very small to completely avoid the actor going up and down.

I am not  sure whether you can achieve this with waypoints.

#3:
There is not eaxctly a built-in cut-scene mechanism in Wintermute, because a cut-scene, if it is not a video, is just commands executed in sequence with the user having no control. What I mean is that you can simply code your cut-scene any way you want.

The secret to achieve this is to simply do the following:
Code: WME Script
  1. Game.Interactive = false;
  2.  
This piece of code will remove the control from the user. You can code your cut-scene after this command and the use this:
Code: WME Script
  1.  
to give back control to the user.

Pages: [1] 2 3 ... 15

Page created in 0.523 seconds with 17 queries.