Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

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 [4] 5 6 ... 15
46
Technical forum / Re: Caption not working
« on: October 30, 2015, 09:35:30 PM »
Yes I think we need to see your game_loop.script to help you further.

47
Technical forum / Re: Caption not working
« on: October 28, 2015, 07:55:02 PM »
After testing this, my code would achieve the same result as your code.

Game.GetItem("item1") does not add the item to the inventory, it returns an object of type Item. Game.TakeItem() is the function that adds an item to the inventory.

Nevertheless your code works, it seems Game.SelectedItem accepts both objects and strings.

To better investigate the issue, I suggest that you add Game.Msg:

Code: WME Script
  1. Game.Msg("Debug: " + Item.Caption);
  2. WinCaption.Text = "Use " + Item.Caption + " with " + ActObj.Caption;
  3.  

If you can't see the message (in debug mode it is displayed at the left of the screen) then I suggest that you add Game.Msg in other parts of game_loop.script. I suggest that you add it after the if statements to try and find what is going on.

48
Technical forum / Re: Caption not working
« on: October 27, 2015, 09:48:58 PM »
I think what you are doing wrong is assigning the string "item1" to Game.SelectedItem. You should assign it an Item object:

Code: WME Script
  1. on "LeftClick"
  2. {
  3.         Game.SelectedItem = Game.GetItem("item1");
  4. }
  5.  

49
Technical forum / Re: AddAttachment and inventory item
« on: October 17, 2015, 06:39:07 PM »
I think you want to do exactly what I wanted. What I do is when I click on an inventory item, I don't want the regular cursor to appear, but I want a custom cursor for each inventory item. In game.script I have:

Code: WME Script
  1. // clicking an inventory item
  2. else if(ActObj.Type == "item" && Item == null)
  3. {
  4.         ActObj.CursorCombined = false;
  5.         Game.SelectedItem = ActObj;
  6. }
  7.  

And in items.items file I have something like the following:

Code: [Select]
ITEM
{
   CURSOR_COMBINED = TRUE
   CAPTION = "Broken Door"
   NAME = "MeansOfEntry"
   IMAGE = "items\Broken Door.png"
   CURSOR = "items\Broken Door Chosen.png"
   CURSOR_HOVER = "items\Broken Door Chosen Highlighted.png"
   SCRIPT = "items\meansOfEntry.script"
}

No code in game_loop.script was needed for this.

Before selection


After selection


Or maybe I still don't understand what you want to do  :-[

50
Technical forum / Re: AddAttachment and inventory item
« on: October 16, 2015, 09:55:05 PM »
Sorry, I meant Game.GetCursorObject(), which returns the cursor sprite. Game.GetCursor() returns the filename which is a string.

51
Technical forum / Re: AddAttachment and inventory item
« on: October 15, 2015, 09:59:03 PM »
What exactly are you trying to do? You have added an item to your inventory with Game.GetItem("bat"). Where do you want the entity to be attached? To the item that you can see in the inventory? That is what I understand from your code.

But from what you say it seems you want to attach an entity on the cursor. If that is correct you need to attach it to the cursor object. Try:

Code: WME Script
  1. //I have not tested this code
  2. var cursor = Game.GetCursor();
  3. cursor.AddAttachment ("entities\my_entity\my_entity.entity", false, 0, 0);
  4.  

52
Technical forum / Re: Inventory box
« on: October 13, 2015, 09:05:48 PM »
I haven't tried this but I found in documentation the command Game.GetInventoryWindow(). Hope this helps you a bit. I haven't had the need to modify my inventory so far so can't help you further.

53
Technical forum / Re: on LeftDoubleClick
« on: October 10, 2015, 11:09:19 PM »
To make sure, first try using the Debug(); command in LeftClick event to see if its code runs together with LeftDoubleClick.

54
Technical forum / Re: Dialogs balloons
« on: September 28, 2015, 10:26:25 PM »
You can check the Ghost In The Sheet implementation for reference:

http://forum.dead-code.org/index.php?topic=3033

55
Technical forum / Re: Variables - scene scope
« on: September 09, 2015, 04:53:47 PM »
I agree with what eborr said. Initially it seems a good idea to have variables to check or control several things, but since you already have the information you need (e.g. whether the layer is Active etc) I believe it is better to query the layers instead of having to set the variables each time a layer becomes Active etc.

This is not from a memory point of view but from code organization point of view. You don't want too many global variables lying around, something that might happens as your game gets bigger. I usually use only the SceneState global variables mostly in case I want to change something on a scene when my actor does something in another scene.

56
Technical forum / Re: Variables - scene scope
« on: September 08, 2015, 05:29:52 PM »
Yes global variables are the way to achieve this communication between your scripts. The default WME scene template creates a global variable you can use, which contains several variables which represent the scene state, e.g. in scene_init.script:

Code: WME Script
  1. ////////////////////////////////////////////////////////////////////////////////
  2. // scene state
  3. global Statenew_scene;
  4.  
  5. // default values
  6. if(Statenew_scene==null)
  7. {
  8.   Statenew_scene.Visited = false;
  9.   // add scene states here
  10. }
  11.  
  12. ////////////////////////////////////////////////////////////////////////////////
  13. // setup scene according to state variables
  14. if(!Statenew_scene.Visited)
  15. {
  16.   Statenew_scene.Visited = true;
  17.   //do something
  18. }
  19.  

I would suggest that you group your global Scene variables this way so you don't get lost.

I am wondering though how many such variables you have in a scene and why do you need them? For instance if you have in a variable which represents whether a scene node is Interactive, you can query the node instead of checking the variable:

Code: WME Script
  1. var hotspot = Scene.GetNode(nodeName);
  2.  
  3. if(hotspot.Interactive){
  4. //do something
  5. }
  6.  

I am not sure how WME handles the memory. I don't know whether setting the variables to null will take up less memory.

57
Technical forum / Re: Questions about 3D
« on: August 19, 2015, 07:47:20 PM »
Hi. I can't answer all your questions with certainty because I work with 2D actors but I will try to answer some:

- Camera: The Scene object has a method named SetActiveCamera(CameraName) which you can use to change the camera. You can use  Scene.SetActiveCamera in the ActorEntry event of the region.

- Run animation: "walk" is the default animation used when the actor is walking. You can change it by changing the actor attribute  actor.WalkAnimName and setting its value to "run" or whatever name you used for your running animation.

- Turning animation: There also exist actor attributes TurnLeftAnimName and TurnRightAnimName that define the turning animations.

- Keep walking when blocked: I don't know about this for certain. Maybe it is the "hold" animation in the actor definition file.

I found this info in http://docs.dead-code.org/
Inside a game -> 3D characters support -> Scripting support
Scripting in WME -> Script language reference -> Actor object

58
Technical forum / Re: Mainmenu scene problem? Book creation.
« on: August 04, 2015, 08:42:21 AM »
Hi TomGamer, welcome to Wintermute!

For your first question:

It seems that in the current scene (Menu) you have loaded your main actor but forgot to hide him. This is probably done in your scene_init.script. You probably don't see the actor because in this scene you are showing a window with buttons etc. which overlaps the actor. In the Menu scene_init.script, you should have something like the following:

Code: WME Script
  1. actor.Active = false;
  2.  

which will hide the actor in the current scene. Take care to show the actor in the scenes you want him visible:

Code: WME Script
  1. actor.Active = true;
  2.  

You can refer to http://docs.dead-code.org/ in Scripting in WME -> Script language reference -> Actor for explanation on the Active property.

For your second question:

What I understand is that you want to click on the topics on the left and show the content in the book in the center. You have several buttons on the left with the topics and a static text in the center. You can have something like the following for each button:

Code: WME Script
  1. on "button"
  2. {
  3.         var textBox = this.GetControl("name_of_static_text");
  4.         textBox.Text = "the text you want to show";
  5. }
  6.  

There is a difficult part here, especially if you are new to programming and don't fully understand objects and objects inside objects. This is because you might have your static text (an object) inside a sub-window (another object), in which case you must change the code to something like this:

Code: WME Script
  1. on "button"
  2. {
  3.         var subWindow = this.GetControl("name_of_subwindow");
  4.         var textBox = subWindow.GetControl("name_of_static_text");
  5.         textBox.Text = "the text you want to show";
  6. }
  7.  

If you have difficulties finding the static text you can show us your window in WME's WindowEdit.

59
Technical forum / Re: Difficulty combining inventory items
« on: July 03, 2015, 10:52:10 PM »
Hello binary1,

So when you switched from the left click menu to the right click one the problem was solved?

Check the following code in the game.script you posted:

Code: WME Script
  1. // what did we click?
  2.   var ActObj = Game.ActiveObject;
  3.   if(ActObj!=null)
  4.   {
  5.         if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
  6.     {
  7.           var Item = Game.SelectedItem;
  8.           if(ActObj.CanHandleEvent(Item.Name)) ActObj.ApplyEvent(Item.Name);
  9.  

ActObj is whatever you clicked on; in your case you clicked syringeFull on tubes, therefore ActObj is the tubes item.
Game.SelectedItem is the item you have selected, in your case syringeFull.

The combination of the items takes place here:

Code: WME Script
  1.  

If tubes item has on "syringeFull" in it's script, ActObj.CanHandleEvent(Item.Name) is true therefore ActObj.ApplyEvent(Item.Name) is executed, which runs whatever code you have in on "syringeFull".

The 3D demo works a bit differently. In game.script there is on "LeftClick" and on "LeftRelease". The code that handles item combination is in on "LeftRelease". It should work though. When you click synringeFull on tubes, on "syringFull" event handler should run.

Anyway, I prefer the right click action menu, so go with that   :D

60
Technical forum / Re: Difficulty combining inventory items
« on: June 28, 2015, 05:59:17 PM »
binary1, I think you need to tell us again what is your problem. You said you solved the first issue with the blood tubes but now you are stuck again. If you solved that one then the solution to your issues should be straightforward. But please re-write your issue and show us your updated code. Combining items is quite straightforward and it is good for you to learn the process because you will be doing it a lot.

Pages: 1 2 3 [4] 5 6 ... 15

Page created in 0.091 seconds with 22 queries.