Menu

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.

Show posts Menu

Topics - xStaH

#1
Hey guys,

Is there an easy way to see how many actual points are in the game? I don't mean how many points I've SAID are in the game, but how many points I've possibly distributed with the GiveScore () function.  I was sloppy and didn't keep track of how many points were actually possible, and I'd hate to go manually look back through all the code.
#2
Hi all,

So I am making a simple game. In my game I wanted to be able to interact with inventory items in the Inventory GUI (the default interact action is to select the inventory item as the active inventory cursor). I spent quite a while searching the forums on how to do this without checking the "run script in inventory" check box and rescripting the whole GUI, and couldn't find much. Eventually I found a quick fix, and I thought I would share it with the community to save others from having to search everywhere, as well as get feed back for improvements.

My goal was to make it appear as the regular interact cursor in graphic and feature.  So here's what I did (remember, I'm a noob, and I figured other noobs could follow this, thus I use a combination of scripting and the graphical style):

1) Go to the cursor menu and make a new cursor.  I called mine "InteractG" (for GUI)

2) In the Global Script, create a new function:

Code: ags

#sectionstart InteractG_Click  //DO NOT EDIT OR REMOVE THIS LINE
    function InteractG_Click(GUIControl *control,  MouseButton button) {
    mouse.Mode = eModeInteractG;
}
#sectionend InteractG_Click  //DO NOT EDIT OR REMOVE THIS LINE


3) On your GUI, create a new button. On the settings box that pops up type "InteractG" in the "Script Name" box, "Run Script" in the "Left Click" box, and "InteractG_Click" in "Click" box.

4) In the "Interactions" menu of your inventory item under "Other Click" insert the command "Run Script" and use code similar to the following:

Code: ags

function inventory5_a() {    // script for Inventory item 5 (Wire): Other click on inventory item
      if (mouse.Mode == eModeInteractG) {
      Display("he has no desire to bend the wire.");  //script whatever you want to happen if you use your new cursor on an item in the GUI
}
}


You may notice a problem.  If you use your new interact cursor on an item and then directly press the ok button on your GUI you new cursor will be the active cursor on your level.  Except it has no function on the actual level and is annoying.  I overcame this by adjusting the following code to the end  "#sectionstart btnInvOk_click"  code.

Code: ags

if (mouse.Mode == eModeInteractG) { //IF THE LAST BUTTON CLICKED WAS THE NEW CURSOR
	  mouse.Mode = eModeInteract; // CHANGE CURSOR TO THE REAL INTERACT


So I hope this helps people. If you see an error or a way to improve this, let me know.  Again, this is a very basic way of working around the problem.
#3
Hi all,

So I'm the first to admit that I am a complete nOOb and this stuff.  But I have a question.  I am trying to make an autosave feature that will append the current date and time to the "autosave" name.  (So it would look like this in the restore GUI;   "Autosave from 05/15 at 2:54".

The code I started with looks like this:

Code: ags

if (GetGraphicalVariable("ParentsRoom") == 1) {
	DateTime *dt = DateTime.Now;	
	SaveGameSlot(99, "Autosave from %02d/%02d at %02d:%02d", dt.DayOfMonth, dt.Month,                 
         dt.Year, dt.Hour, dt.Minute);
}

Right away this looked too clumsy to me. And of course I get the error "The wrong number of parameters is called to SaveGameSlot".  But I've searched for an hour now and can't find out how I could do this, though I am sure its a simple fix.  Any suggestions or places you could direct my searches?  Thanks guys.

SMF spam blocked by CleanTalk