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

Messages - kIM

#1
Hints & Tips / Re: Beyond the horizon
Mon 13/10/2008 11:49:23
I was nice to the nurce. I have the gun, wallet, Maloys letter , wire cutter, screwdriver, cable. I have also Jansons number and Maloys adress. To get Maloys number I have to call Janson (in the hints & tips).  Wenn I dial Jansons number (24976) however, I get the message "Dialed the wrong number, sorry." Did I miss something? Can someone help me, please?
Thanks.
#2
Sorry, no buttons appear in my window, only smileys. I will try to be clear.

After my last scripting catastrophe I made a new testgame. Now again, after I did something wron again, I got the message: Unable to open custom exe 'Compiled\Poging1.exe' for writing.

What I did:

1)
In Room1 I created a hotspot( hotspot2) with a property ‘exit' to differentiate it from other hotspots in rep_exec  in the global script, where I define my cursor graphics.
In the interaction editor I run a script that works fine:
Code:
// script for Hotspot 2 (Hotspot 2): Look at hotspot
if(mouse.IsButtonDown(eMouseRight)){
  player.ChangeRoom(2, 240, 140);
}
if(mouse.IsButtonDown(eMouseLeft)){
   character[CHARACTER].Walk(187, 119,eBlock);
   DisplayMessage(4);
}

2)
Also in Room 1 I created a second hotspot (hotspot3) with the same ‘exit' property and the same code. Only the numbers were differernt. So, message(4) became message(3). It works fine.

3)
In Room3 I created a similar hotspot with similar code and with the same DisplayMessage(3).
I got an error:In room3 script(line13) DisplayMessage:Invalid message number to display.
:-[Of course, it referred to a room message of another room! :-[

4)
Here it comes:
I created a global message 500 with the same words and adapted the message numbers for the hotspots in both room scripts.
After that, everything was grey in the file menu, exept prefernces, I think.  I even could not quit the program. In fact, I could not do anything anymore. A crash?

5)
I forced quit with Ctrl+Alt+Delete.
After that I get the ‘Unable to open …' message, when CHARACTER has walked to the coordinates in Room3.

Does someone know a remedy for this illness?

By the way, Ashen, I did not use the double_click code because it seemed to interfere with my cursorgraphics. When I deleted the lines referring to the Wait graphic, it did not work at all. Anyway, thank you for your answer and the trouble.

I would also like to know what the character ‘*' means in the following code:
double_click = WaitMouseKey(10)*mouse.IsButtonDown(eMouseLeft);
I  only understand for example this:
Hotspot*myhotspot;
myhotspot= whatever_that returns a value;
The pointers for newbies section did not make me wiser

Thanks to anybody who can help me.

#3
Well, stupid at scripting as I am, I just put it above everything in global script. As I got error messages, I put the ‘int doubleclick' on top and the rest in game-start, and imported it as a function, fut rectified that after an error message.

Code:

    doubleclick = WaitMouseKey(8)*mouse.IsButtonDown(eMouseLeft);
Mouse.UseModeGraphic(eModeUsermode1);
export doubleclick;

After error messages I transferred everything to on-button-click, also the' int doubleclick'.
After some other error messages I came up with this code, and got the blocking function message. It is however possible, that, at that moment, the code was not deleted in game-start. It could be, that I forgot that and deleted it only after I got the message. I did not pay attention what was written on line 9, as I thought, the problem would be solved by deleting.

My code:
#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
int doubleclick;
function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
  }
  else if (button == eMouseLeft) {

   ProcessClick(mouse.x,mouse.y,mouse.Mode);
    doubleclick = WaitMouseKey(8)*mouse.IsButtonDown(eMouseLeft);
Mouse.UseModeGraphic(eModeUsermode1);
export doubleclick;
}
else{
}

#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE

It is possible, that, at that moment, the code was not deleted in game-start. It could be, that I forgot that and deleted it only after I got the message. I did not pay attention what was written on line 9, as I thought, the problem would be solved by deleting.
I gess, that, with all my doings, the engine got confused and stored things somewhere I cannot get at?

I read the code in Daryls thread ‘The Dig Template”:
________________________________________
Citation about double click:
.....
*edit* new progress..

Code:
int double_click;

if (button==eMouseLeft) {
//SetMouseCursor(GetCursorMode()); // stops wait cursor appearing
double_click = WaitMouseKey(8);
mouse.IsButtonDown(eMouseLeft);
//SetDefaultCursor(2);

if (double_click) {

So I got past the error msgs.. Now I need to bind a function to the double click. Perhaps by adding a custom property to the hotspot I want to double click in? I'm not sure how to add code such as "if double_click over hotspot X, trigger player.ChangeRoom();"
Any idea?
Thanks..

-------------------------------------------------------
To add code such as "if double_click over hotspot X, trigger player.ChangeRoom();", you just create an interaction on hotspot X when it's clicked, and have something like:

Code:
import double_click; // Your global script will need a "export double_click;" on the end, too

function hotspot1_a()
{
  if (double_click)
    player.ChangeRoom();
}
-------------------------------------------------------------

Thanks a bunch man, that worked actually great, after some more research. I had to put the int double_click; up in the global script before any sectionstarts to be able to export it. I added the export double_click; like you said, and used your code in the room script but I had to add int before double_click to be able to import it. Also, even though I renamed the script-O-Name to hPortalLeft it still had to be hotspot3_a() for AGS to recognize it, a bit odd?
………………………..
______________________________________________
End of citation.

Thank you for your concern, Ashen. But if you don't see a possible solution immediately, please tell me so and do not bother. I will make a new testgame and post my code for criticism, before compiling.  Maybe you could, by the way, tell me, what is wrong in my last script in on-mouse-click. Thanks.
P.S. WaitMousekey (eight) changes into a smiley.Can't help that.

#4
Quote from: kIM on Thu 11/10/2007 15:33:25
I messed up when trying out double click code from topic 12190.0.  When I testet the game, I got the error: "Unable to open custom exe'Compiled\Testgame.exe. Global script, line 9: A blocking function was called before the first room has been loaded."

So I deleted every double click code line in the main global script, the script header, I deleted even the  hotspots. But I still get the message.

EDIT
Thank you for your suggestion, Akatosh and KrisMUC, but there is nothing in there. Game-Start is empty.
As I got error messages, I deleted the code in the game-start section and put everything  in On-mouse-click. and an' int doubleclick' on top of the global script. Now everything is deleted, also in the On-mouse-click-section. I have other code in Rep-exec, but nothing I know of with 'doubleclick'. I think I messed eround too much with the code.  ???

Maybe, as a noob at scripting with glased over eyes, I should ask for advice about my code in the forum, before trying stupid things. :-[

Did you check your game_start section in the global script?

Yes. See EDIT above. I wanted to avoid a double post, but maybe someone can still help me out?
#5
I messed up when trying out double click code from topic 12190.0.  When I testet the game, I got the error: "Unable to open custom exe'Compiled\Testgame.exe. Global script, line 9: A blocking function was called before the first room has been loaded."

So I deleted every double click code line in the main global script, the script header, I deleted even the  hotspots. But I still get the message.

EDIT
Thank you for your suggestion, Akatosh and KrisMUC, but there is nothing in there. Game-Start is empty.
As I got error messages, I deleted the code in the game-start section and put everything  in On-mouse-click. and an' int doubleclick' on top of the global script. Now everything is deleted, also in the On-mouse-click-section. I have other code in Rep-exec, but nothing I know of with 'doubleclick'. I think I messed eround too much with the code.  ???

Maybe, as a noob at scripting with glased over eyes, I should ask for advice about my code in the forum, before trying stupid things. :-[
#6
I tried it, but without the variable, the cursor does not animate at all.
Thanks anyway.

EDIT:
I tried this code and it works perfectly:

#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE{
  // put anything you want to happen every game cycle here
function repeatedly_execute(){

if(GetLocationType(mouse.x, mouse.y)!=eLocationNothing)
if(mouse.Mode==eModeWalkto){
  mouse.SaveCursorUntilItLeaves();
  mouse.Mode=eModeInteract;
}
else{   
}
}
  :D I am happy as a kid.
#7
I did not expect an answer so soon. Thank you KrisMUC. I quit the game without saving. Later I testet it and there was no error message about the on_ key_press function any more. After some “cleaning up” I testet again, and every thing worked. But I am not happy with it because of the slowness. I have sometimes to hover again and again over hotspots and objects, going from one to another, before the cursor changes into the animating one. I also had a region covering a small colum on the richt side of the window, with no interaction at all, and wenn I clicked on it in Walk mode, EGO displayed a message that was meant for a hotspot somewhere in the middle of the window? ?? There are definitly things I do not understand. This game has resolution 640-400, and 8  bit colors.

Kim
#8
Hallo, his is my first post.

I have no experience with scripting and please excuse my lack of experience with wrighting english too.

I made a script about cursors(see far below), but cannot test or save my game because of following error message: There was an error compiling your script. The problem was: In ‘Global script ‘
Error (line 36): Nested functions not supported (you may have forgotten a closing brace).

I am not aware, that I changed anything in this default script, and I do not see something wrong:

#sectionstart on_key_press  // DO NOT EDIT OR REMOVE THIS LINE
Line 36:  function on_key_press(int keycode) // called when a key is pressed. keycode holds the key's ASCII code
  {
  if (IsGamePaused()==1) keycode=0; // game paused, so don't react to keypresses
  if (keycode==17) QuitGame(1); // Ctrl-Q
  if (keycode==363) SaveGameDialog(); // F5
  if (keycode==365) RestoreGameDialog(); // F7
  if (keycode==367) RestartGame(); // F9
  if (keycode==434) SaveScreenShot("scrnshot.pcx");  // F12
  if (keycode==9) InventoryScreen(); // Tab, show inventory
  if (keycode==19) Debug(0,0); // Ctrl-S, give all inventory
  if (keycode==22) Debug(1,0); // Ctrl-V, version
  if (keycode==1) Debug(2,0); // Ctrl-A, show walkable areas
  if (keycode==24) Debug(3,0); // Ctrl-X, teleport to room
  }
#sectionend on_key_press  // DO NOT EDIT OR REMOVE THIS LINE

Maybe I can delete the whole thing, as I do not use it?

The script I wanted to test should change the mouse.Mode automatically to eModeInteract, wenn over a hotspot, etc. and animate with view INTER, loop 0. When I only change the curor mode automatically, the animation does not work any more. So I must tell the engine in a script, to animate.
I wrote one inspired from a respons from Ashen to a question about animating a cursor wenn over one specific hotspot. Mine is meant to work in all the rooms and also on regions. On regions I want to change the cursor graphic to still another one, also animating, but for a beginning I prefer to try this script first., because I do not know yet where to put the region thing with the Region.GetAtRoomXY …. function in the script. I am sorry, it all looks very complicated to me.

Code:

#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE{
  // put anything you want to happen every game cycle here

int cursorset;
function repeatedly_execute(){
if(GetLocationType(mouse.x, mouse.y)==eLocationNothing)
  if(cursorset==0){
mouse.Mode=eModeWalkto;
cursorset=1;
}
else{
  if(cursorset==1){
    mouse.Mode=eModeInteract;
    Mouse.ChangeModeView(eModeInteract,INTER);
   
cursorset=0;
}
}


Maybe I should use global integers here, but I have no clue how to do that.

If anyone with experience would tell me if there is something wrong with what I have written and explain it to me, I would be gratefull.

Kim

SMF spam blocked by CleanTalk