Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

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 - binary1

Pages: [1] 2 3 4
1
Technical forum / Re: Difficulty combining inventory items
« on: July 03, 2015, 06:16:10 AM »
Hello Anarchist,
Thanks for your response.  I was actually already combining two inventory items without any problem so I couldn't figure out what was going wrong.  I posted the code that I had in the first posting.

Here is the situation.  I have a dog, an empty syringe, and empty tubes in inventory.  I click on the dog with the empty syringe which causes the empty syringe to be be deleted and a filled syringe to appear in inventory.  (It never occurred to me to click the syringe with the dog. That would be a bit awkward.)  Then I wanted to fill the tubes using the filled syringe.  That is the part that wouldn't work.

I am using the action menu that was in the 3D demo.  If the left mouse button is held down, the action menu appears.  In the initial script that I had, I only implemented on "LeftClick" for both objects, on "tubes" for the syringe and on "filledSyringe" for the tubes.  I think that what happens is that whichever item is clicked becomes the game selected item.  on "tubes" and on "filledSyringe" never run.

The first solution was just to leave the empty tubes on the counter, never take them into inventory and click on them with the filled syringe.  But that left me with similar problems elsewhere. 

The best solution was to implement on "Take" for the empty tubes and filled syringe.  For the filled syringe I have on "LeftClick" and on "tubes" as in my first posting below.  For the tubes, I have on "LeftClick" and on "filledSyringe" as in my first posting below.  I also have on "Take" for both objects, which is the same as the on "LeftClick" method.  The one for the filled syringe is as follows:
Code: [Select]
on "Take"
{
  Game.SelectedItem = "syringeFull";
}

Everything now runs correctly.  I think the problem only occurs when the left click action menu is used, not a right click menu. 

2
Technical forum / Re: Difficulty combining inventory items
« on: June 27, 2015, 02:45:09 AM »
It should be on "stethoscope", kind of like on "LeftClick".  The methods.script has some additional methods - it was suggested in the test3d demo with Victor from DREAMWEB. It is a really helpful tutorial for 3d actors.  It is still available - just search for dreamweb for the link.

Meanwhile, I tried going forwards from the old program.  I changed the game and game loop scripts to the new code and copied the new scene to the old program.  I had to make some changes to the script for the model and things are working okay.  So the problem isn't with the game and gameloop scripts.  For now, I'll probably just have the lab doctor tell the main character to place the samples on the table.  When the main actor exists, the sample will be deleted and a report will go into the record.  When I have time, I'll keep working on replacing code in the first version.  I've made a lot of changes so it will take a while.

Thanks for your help!  If you think of anything else to try ...


3
Technical forum / Re: Difficulty combining inventory items
« on: June 27, 2015, 12:22:38 AM »
Thanks.  That is what I thought too.  Our internet has been down - we're out in the country and can't get cable and there is a thunderstorm.  While off line, I copied the project to test.  I have an older version of the project that I tested first.  I put the male model in the examination room with the dog.  I can use the stethoscope with either one of them and get the correct response.

So then one by one, I did the following:
1. Copied the game.script to the new project.
2. Copied the gameloop.script to the new project.
3. The items.items code was identical.
4. Copied the stethoscope.script code (only minor changes there).
5. The model was the same since it wasn't in the old version - I just copied it in for testing.

I checked at each level but no change.

Lastly I tried copied the scene_init.script.  Still no change (except that everything was misplaced since the background has been changed).

Here is the game code but it is identical to the working version except that I commented out a model that is now added only to the scene.

Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"

//jah these are from actor 3d
global ClickStarted;
global ClickStartTime;
global ClickObject;

//jah from advice on disabling inventory
//still see in intro, not in menu
InventoryActive = true;

// store some of the game's attributes in global variables for convenience
Keyboard = Game.Keyboard;
Scene = Game.Scene;


// load the right-click menu
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
WinMenu.Visible = false;

// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetControl("caption");

global WinRecords = Game.LoadWindow("records/records.window");
WinRecords.Visible = false;

global MenuObject = null;

//jah load victor instead of trinity
//actor = Game.LoadActor3D("actors\trinity\trinity.act3d");
client = Game.LoadActor3D("actors\victor\victor.act3d");
vetM = Game.LoadActor3D("actors\vetM\vetM.act3d");
vetF = Game.LoadActor3D("actors\vetM\vetF.act3d");
patient = Game.LoadActor3D("actors\dudley\dudley.act3d");
//receptionist = Game.LoadActor3D("actors\vetM\receptionist.act3d");
actor = vetM;
Game.MainObject = actor;

//jah from tech demo load victor
// load our EmptyActor for inventory responces in the first persons scenes
//global EmptyActor;
EmptyActor = Game.LoadActor("actors\empty\empty.actor");
EmptyActor.SkipTo(400, 100);

//jah not sure about next object this might be inventory problem
//Game.InventoryObject = actor;

// run the "game loop" script
Game.AttachScript("scripts\game_loop.script");

//from testdemo for inventoryglob
// run the "Methods" script
Game.AttachScript("scripts\methods.script");

//jah not sure about this Game.InventoryVisible = true;
// which scene to load?
Game.ChangeScene(Game.StartupScene);

//metamorphium system_writer
writer = new Object("scripts\system_writer.script");
writer.Initialize();

////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  // what did we click?
  var ActObj = Game.ActiveObject;
  if(ActObj!=null)
  {
if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
    {
  var Item = Game.SelectedItem;
      if(ActObj.CanHandleEvent(Item.Name)) ActObj.ApplyEvent(Item.Name);
      else if(Item.CanHandleEvent("default-use")) Item.ApplyEvent("default-use");
      else if(ActObj.CanHandleEvent("default-use")) ActObj.ApplyEvent("default-use");
  //jah from tech demo when actor not visible
  else if(actor.Active ==  false)
{
EmptyActor.Talk("I can't use these things together.");
}
  else actor.Talk("I can't use these things together.");

    }
    // just a simple click
    else ActObj.ApplyEvent("LeftClick");

  }
  // else propagate the LeftClick event to a scene
  else
  {
    Scene.ApplyEvent("LeftClick");
  }
}



////////////////////////////////////////////////////////////////////////////////
on "RightClick"
{
  // if inventory item selected? deselect it
  if (Game.SelectedItem != null){
    Game.SelectedItem = null;
    return;
  }

  var ActObj = Game.ActiveObject;

  // is the righ-click menu visible? hide it
  if(WinMenu.Visible == true) WinMenu.Visible = false;
  else if(ActObj!=null)
  {
    // if the clicked object can handle any of the "verbs", display the right-click menu
    if(ActObj.CanHandleEvent("Take") || ActObj.CanHandleEvent("Talk") || ActObj.CanHandleEvent("LookAt"))
    {
      // store the clicked object in a global variable MenuObject
      MenuObject = Game.ActiveObject;
      var Caption = WinMenu.GetControl("caption");
      Caption.Text = MenuObject.Caption;

      // adjust menu's position
      WinMenu.X = Game.MouseX - WinMenu.Width / 2;
      if(WinMenu.X < 0) WinMenu.X = 0;
      if(WinMenu.X+WinMenu.Width>Game.ScreenWidth) WinMenu.X = Game.ScreenWidth-WinMenu.Width;

      WinMenu.Y = Game.MouseY - WinMenu.Height / 2;
      if(WinMenu.Y<0) WinMenu.Y = 0;
      if(WinMenu.Y+WinMenu.Height>Game.ScreenHeight) WinMenu.Y = Game.ScreenHeight-WinMenu.Height;

      // and show the right-click menu
      WinMenu.Visible = true;

      // stop the actor from whatever he was going to do
      actor.Reset();
    }
    // no verbs supported, no menu is needed; just send the RightClick event to the object
    else ActObj.ApplyEvent("RightClick");
  }
}

//jah added left double click in case it is needed
//from tech demo
on "LeftDoubleClick"
{
  // what did we click?
  var ActObj = Game.ActiveObject;
  if(ActObj!=null)
  {
    // just a simple click
    ActObj.ApplyEvent("LeftDoubleClick");
  }

  // else propagate the LeftDoubleClick event to a scene
  else
  {
    Scene.ApplyEvent("LeftDoubleClick");
  }
}

////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  // on Esc or F1 key
  if(Keyboard.KeyCode==VK_ESCAPE || Keyboard.KeyCode==VK_F1)
  {
    // load and display the main menu window
    WinCaption.Visible = false;
    var WinMainMenu = Game.LoadWindow("interface\system\mainmenu.window");
    WinMainMenu.Center();
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);
  }
}


////////////////////////////////////////////////////////////////////////////////
on "QuitGame"
{
  // on Alt+F4 (window close)
  // load and display the quit confirmation window
  if(QuestionBox("Do you really want to quit?")) Game.QuitGame();
}


////////////////////////////////////////////////////////////////////////////////
method QuestionBox(Message, SystemExclusive)
{
if(SystemExclusive==null) SystemExclusive = true;

var Window = Game.LoadWindow("interface\system\question.window");
Window.Center();
Window.xMessage = Game.ExpandString(Message);

if(SystemExclusive) Window.GoSystemExclusive();
else Window.GoExclusive();

var Result = Window.xResult;
Game.UnloadObject(Window);

return Result;
}

I'm going to try moving the entire scene from the old game into the new one to see if there is anything there.  I completely recreated that scene.  After that I'm out of ideas.

Thanks again!

4
Technical forum / Re: Difficulty combining inventory items
« on: June 26, 2015, 09:06:04 PM »
Thanks Dan.

I based the code on Metamorphium's WME book where the wire and and pliers were combined.  In the game code, I am using the method from the 3d demo project where if you hold down on the left key, the action menu pops up.  For now, I'm leaving the empty tubes on the table.  When you click on the empty tubes with the filled syringe from the inventory, the filled tubes are taken into the inventory and the syringe and empty tubes are deleted.

Now I have a similar problem.  I can click on the full container and filled tubes in the inventory and select them but I can't use them with anything.  What I want to do is go to the lab, click on the lab doctor to generate a report and delete the two items.  I use other items from the inventory on a different model in another scene so I tried using these on the lab doctor.  I didn't get what I expected.

I have
Code: [Select]
"on stethoscope"
{
    //do something
}

 for the dog in one room and the doctor in the other.  This is in the script for each of the 3D models in the 3D actors folders.  The player's character gets the stethoscope in the room where the dog is and then goes to the second room.  When the stethoscope is taken from the inventory and clicked on the doctor, the code for the dog model runs.


Is this expected?  Can you only click with an inventory item in the room where you get it or should I be looking for a problem in the game code?  Or am I putting "on stethoscope" in the wrong place?

5
Technical forum / Difficulty combining inventory items
« on: June 25, 2015, 12:37:48 AM »
Hi,

I'm trying to follow the technique used in the WME book for combining items in the inventory.  I've got other items that work fine so I'm not sure what is wrong here.  This is a teaching app for veterinary students.

I have a dog, a syringe, and empty blood tubes in the inventory.  The idea is to click on the patient (the dog) with the syringe.  The syringe changes to a filled syringe.  That part works fine.  The next step is to click on the tubes with the syringe or click on the syringe with the tubes.  The tubes and syringe are deleted and filled blood tubes are now in the inventory. 

Here is the code in items:

Code: [Select]
ITEM
{
   CURSOR_COMBINED = TRUE
   CAPTION = "Filled Syringe"
   NAME = "syringeFull"
   IMAGE = "items\syringeFull.png"
   CURSOR = "items\syringeFull.sprite"
   CURSOR_HOVER = "items\syringeFull_h.png"
   SCRIPT = "items\syringeFull.script"
}

ITEM
{
   CURSOR_COMBINED = TRUE
   CAPTION = "Blood Tubes"
   NAME = "tubes"
   IMAGE = "items\tubes.png"
   CURSOR = "items\tubes.sprite"
   CURSOR_HOVER = "items\tubes_h.png"
   SCRIPT = "items\tubes.script"
}

ITEM
{
   CURSOR_COMBINED = TRUE
   CAPTION = "Filled Blood Tubes"
   NAME = "tubesFull"
   IMAGE = "items\tubesFull.png"
   CURSOR = "items\tubesFull.sprite"
   CURSOR_HOVER = "items\tubesFull_h.png"
   SCRIPT = "items\tubesFull.script"
}

And the code for the filled syringe:
Code: [Select]
////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  Game.SelectedItem = "syringeFull";
}

////////////////////////////////////////////////////////////////////////////////
on "tubes"
{
Game.Interactive = false;
actor.Talk("I'll fill these blood tubes");
Game.TakeItem("tubesFull");
Game.DeleteItem("tubes");
Game.Interactive = true;
Game.DeleteItem("syringeFull");
}

and finally, similar code for the empty tubes:
Code: [Select]
////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  Game.SelectedItem = "tubes";
}

on "syringeFull"
{
Game.Interactive = false;
actor.Talk("I'll fill these blood tubes");
Game.TakeItem("tubesFull");
Game.DeleteItem("syringeFull");
Game.Interactive = true;
Game.DeleteItem("tubes");
}

I have sprites for the filled syringe, the empty tubes and the filled tubes, all with the correct names.  I don't get any errors.  I see the text "use something with something" but nothing happens when I click.  Do I need to put anything in the scene?  I've deleted the sprites and recreated them without any success and I'm not sure what to try.

Any thoughts?

6
Technical forum / Re: Interactive Code Problem
« on: June 24, 2015, 11:13:38 PM »
I'm not sure exactly what you mean.  When you click on the region, are you making the region non-interactive?  You could try using the name of the structures as in myRegion.interactive = false; 

If everything resets when you come back in, you could set a global flag something like global canInteract = true; in the game.script.  Then, when you click on the region:

on "LeftClick"
{
  canInteract = false;
  this.Interactive = false;
}

In the init method for the scene, check the flag
if (canInteract == false)
{
   myRegion.Interactive = false;
}

else
{
  myRegion.Interactive = true;
}

I'm not sure if that's what you are looking for.

7
Technical forum / Re: invalid image for thumbnail
« on: June 19, 2015, 09:58:35 PM »
Thanks!  That looked pretty much like what was in the 3D demo code.  When I looked back at mine, I realized that I had made some changes before setting the thumbnail height and width.  As a result, things still weren't working when I enabled thumbnails.  I put things back to the original code and everything works great now.  Your explanation was just what I needed.

If anyone else is having the same problem (before making changes in the code), look at the Project Manager under Saved Games.  If thumbnail width and height are set to zero, no thumbnail will be generated.  The 3D demo set the width and height to 270, 200, which is also working well for me.

8
Technical forum / Re: invalid image for thumbnail
« on: June 18, 2015, 10:30:17 PM »
I compared my project with the demo 3D project and found settings that needed to be changed.  I set the thumbnail width and height to the settings given in the 3D demo.  I looked at Game.SaveThumbnail() and put it in my code.  However, that only returns true or false so I don't see how I can access the thumbnail.  It apparently is used by Game.SaveGame() but mine is identical to the one in the 3D demo.

Any other suggestions?  Or can anyone give me insight into how and where thumbnails are saved?

9
Technical forum / invalid image for thumbnail
« on: June 17, 2015, 11:09:19 PM »
When I save or load a game, I only see a label "invalid image" for the thumbnail.  I've gone through the 3d demo looking at all the scripts for loading, saving games but can't find anything different from what I have.  I see where the thumbnail object is getting the image but I don't see when the screenshot is being made in the script.  There is a flash on the screen when the save button is pressed so I'm guessing that is when the screenshot is made but what method is being called and where?  I don't see anything in the game script either.

This is in the saveslot.script: Thumbnail.SetImage("savegame:" + this.Name);
Printing this.Name to the screen just shows the number of the slot so where is the image coming from?  Or, in my case not coming from?

I found Screenshot, ScreenshotEx, and StoreSaveThumbnail functions under the game object but I don't see where any of these are being called in the script for the demo.  I've searched the forum but haven't come up with a solution.  Do I need to call one of these functions or a different one?  How does the demo create the screenshot?

Thanks.

10
Technical forum / Re: Slider problem
« on: June 05, 2015, 11:45:10 PM »
Everything is working great now!  I think the main problems were that I wasn't accounting for Parent.X and IsDragging was set incorrectly.  Thanks both of you!  That solved a major headache because I want to do something similar to display images elsewhere in the program.

11
Technical forum / Re: Slider problem
« on: June 05, 2015, 01:54:30 AM »
@Mnemonic:  Thank you so much!  That worked right out of the box. I'll start comparing the two codes to see where I went wrong.  The arrow keys worked ok but it is a lot more intuitive to click and drag.  It was a big problem for me because I need it for another window too.

@Dan Peach.  Thanks.  I'll make sure I put the LeftRelease in the right place.  I'm interested to see why my cursor is way off to the side.  That was the other problem I was having. 

I was at work all day but I'm back on it now.

12
Technical forum / Re: Slider problem
« on: June 04, 2015, 02:36:02 AM »
Still stuck.  I created a new window using the question template.  I added one horizontal slider bar and one slider button.  I cut and pasted the code from Dan Peach into a script and attached it to the slider button.  The only things I changed were the numbers for the beginning and end of the slider bar.  I have Parent Notify set to true and Focusable set to false.  When I click on the slider button, it only starts to move when the mouse is moved way to the left and it moves regardless of whether or not the mouse button is down.  It also doesn't matter what the y value of the mouse cursor is.  Once clicked, the slider moves left when the mouse is moved left and right when the mouse is moved to the right but the cursor isn't on the button. The slider is staying on the bar but the cursor is all over the screen, including off the window.

As a work around, I am moving the slider button using the arrow keys.  That works fine but I'd rather use the mouse if someone can tell me what I am doing wrong.

Thanks.

13
Technical forum / Re: Slider problem
« on: June 03, 2015, 06:17:39 PM »
Thanks.  It works better but I'm still having problems.

The slider is now staying on the bar but it keeps dragging even when I release the mouse.  Also the game mouse is way off to the side and is actually off the window.

I tried putting the following in the code that calls the window:
   var tech = Game.LoadWindow("interface\slider\slider.window");
   tech.Center();
   tech.GoSystemExclusive();

That put the window in the bottom right corner.  Without tech.Center(), it was in the middle of the screen.

In the slider window, for the mASlider button, I have Parent Notify set to true and Focusable set to true.

Code: [Select]
global IsDragging = false;
//var IsDragging = false;

on "LeftClick"
{
IsDragging = true;
//PlaySounds();

while(IsDragging)
{
if(Game.MouseX > MinX  && Game.MouseX < MaxX)
{
Game.Msg("Game.MouseX is " + Game.MouseX);
Game.Msg("mASlider.X is " + mASlider.X);
this.X = Game.MouseX;;
//set variable here
//Game.SetGlobalMusicVolume
}
Sleep(1);
}
}


////////////////////////////////////////////////////////////////////////////////
on "LeftRelease"
{
IsDragging = false;
//StopSounds();
}


Any more suggestions?  I'm going to try starting over with another window.

14
Technical forum / Re: Slider problem
« on: June 03, 2015, 04:37:03 AM »
I have three scrollbars each with a button that is moved to the right increasing the value.  That part is similar to setting the volume control but instead of calling a method to play a sound file, after the three sliders are set, there will be a method to display an image.  It is actually a radiograph and the values are mA, kVp and time.  If the values are set too low, the displayed radiograph will be too light. If they are too high, the radiograph will be too dark.  There is another button to display a technique chart.  I'm having trouble getting the mouse cursor to drag the slider along the scroll bar.  Currently, I can drag the slider.  It temporarily "sticks" to the scrollbar but if I keep dragging, I can pull it off the bar.

Do you remember how you did the volume slider?

Thanks.

15
Technical forum / Re: Slider problem
« on: June 02, 2015, 05:10:02 PM »
Thanks eborr!  I saw that you were working on a similar problem when I was searching the forum.

The user clicks on a computer console that brings up a window with the three slider bars.  The script is attached to the main window so I this should refer to the window that contains the slider bars.  I don't really need the parent part.  I had tried previously to attach a script to the slider but that resulted in the whole window moving around sometimes.  I have a number of variations by now but the one I posted seemed to be closest.  I read the material on windows in the online documentation and that was enough for all the menus that I have in the program but didn't have material that helped me with this.  Is there any other tutorial somewhere that I haven't found?

Pages: [1] 2 3 4

Page created in 0.398 seconds with 22 queries.