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

#81
Quote from: Ashen on Mon 11/12/2006 11:30:50
So it's working now? That's the non-functioning code, which you've replaced with the working version or do you still need help getting that to work? (I guess it works, since you've marked this Solved and all...)


It's working fine.
Thanks for the alternative code. It's a lot "cleaner".
#82
Thanks Ashen.

I knew that I would have to track it in an array but I always get confused with with them for some reason. I ended up with this code late last night but obviously I messed up:
Code: ags


#define NUMBER_OF_OBJECTS 10
int Sprite[NUMBER_OF_OBJECTS]; 
int Sprite // had to do this to save
function ChangeNumbers(int block){

Ã,  if(mouse.Mode == eModeInteract){
Ã,  Sprite++;//messed up (needs to increase on first click so the placement is correct)
Ã,  object[block].SetView(2, 1, Sprite[block]);
Ã,  
Ã,  }
Ã,  if(Sprite == 11){//messed up
Ã,  Ã,  Sprite = 0;//messed up
Ã,  }

}



I can read the damn stuff but I always screw it up when I have to do it. Its like being able to understand a foreign language but not being able speak it!

Anyway, your code is just what I needed thanks.

As for the application, I'm using it to spin the 3 dails on a panel (to unlock a slide on a gate)

#83
I have 3 objects that must change every time you click on them.
I've set up a view (2) with a loop(1) and 10 sprites. I used the code below but it is obvious that even though it will work 100% for the fist object you click on i.e. start at the first frame, it will jump to the next frame in the loop (where the previous object stopped) when you click on the next object.
Code: ags

int Sprite = 0;
function ChangeNumbers(int block){
Ã,  
Ã,  if(mouse.Mode == eModeInteract){
Ã,  object[block].SetView(2, 1, Sprite);
Ã,  Sprite++;
Ã,  }
Ã,  if(Sprite ==11){
Ã,  Ã,  Sprite = 0;
Ã,  }

}


I know it's something stupid but I just cannot figure it out.
#84
Thank you gentleman.
As you pointed out I did not include a space at then end of the first line of text.
#85
Take a look at this thread. It should shed some light on the subject.
#86
Quote from: SteveMcCrea on Sat 09/12/2006 18:08:23
actually, it's the character after the underscore that causes the problem. If you write
Code: ags

Hypertext.Add("Test", "John and Joe played _Fred|Tic-Tac-Toe._ ");
Hypertext.Add("Test", "After 10 games the score was tied at 5 each. ");

it works fine.

Steve ,
I tried it and the problem is still the same (AGS version 2.72)
#87
Another excellent module.

I played around with the demo a bit and get a warning when I exit the game
(room1): Dynamic sprite 7 was never deleted
(room1):Dynamic sprite 8 was never deleted

Also if you do the mark up for hypertext using the last word in a string it wraps around to the next string and the whole block of text becomes the hyperlink.
Example:

Hypertext.Add("Test", "John and Joe played _Fred|Tic-Tac-Toe_.");
Hypertext.Add("Test", "After 10 games the score was tied at 5 each. ");

Renders as:

John and Joe played Tic-Tac-Toe_. After 10 games the score was tied at 5 each.

not as:

John and Joe played Tic-Tac-Toe. After 10 games the score was tied at 5 each.

I suppose you can always plan your text in such a way that you never use the last word in a string to create the hyperlink. Not a big issue.

Thanks again for your time and effortÃ,  ;D
#88
Thanks SSH! ;D
I have no idea how you come up with these modules so fast but I appreciate the time and effort that went into this. I just hope that my game will do it justice.

GREAT WORK!!
#89
Holy mackerel :o

That was pretty quick and right on the money too!
Can't wait to see the final product with all the bells and whistles.
Great work!
#90
Quote from: GarageGothic on Tue 05/12/2006 15:45:35
I have coded a system like this, which emulates basic html functionality (also inspired by SYDNEY). It's quite similar to what SSH describes, except it uses pure RawDraw instead of GUIs. It was rather complicated and I wouldn't recommend it to a beginner, even though most of the big problems were related to line-breaking, scrolling/non-scrolling frames and images inserted into the text - things you don't mention needing.

Wow,
That is exactly what I am looking for (at the top of my Christmas wish list ;D) but I toned it down as I imagined that it would be way too ambitious for me to attempt something like that and that it is best left to the experts.

I'm planning on doing something similar to Gabriel Knight III where the user will have to do research on the PDA to unlock certain information that can be used in solving puzzles later on in the game. It will also be “turn based” i.e. a different character will fulfill this role and these chapters will take up about 30% of the game. The ability to add visual representation of information disclosed will just enhance the impact of the storyline a 100 fold. The ideal is that the interface should behave exactly like a browser with all the bells and whistles but like I said, it's on my wish list so I'll settle for a toned down version.

I managed to do the basic layout where I can add “web pages” (using text boxes) and move back and forth between them or edit and add information. It's just that I have absolutely no idea how to do the rest of it although the hyperlink part should not be that much of an issue as SSH mentioned (just track the “entry numbers”).
The biggest problem as I see it is to get parts of the text to stand out so the user will know that it needs further investigation. It just seems natural to me that this should be in a different colour than the original text.

Quote from: SSH on Tue 05/12/2006 16:03:44
I was thinking of some system like having your text marked up, but characters at the front of a word give special markup, e.g.

=John =and =Joe[John /and Joe played _Tic-Tac-Toe

Rendering as something like:

John and Joe
John and Joe played Tic-Tac-Toe

Great as usual but then again I would expect nothing less from the "Module Master". The walk sequence genarator is one off your greatest "inventions" in my humble opinion. Saved me hours of work so far.
#91
SSH

Thanks for the response.

The PDA is used often in the game so the first option will become very untidy.

As for the second suggestion I think it is possibly beyond my coding skills but for and expert module writer like yourself it may seem easy(hint hint). Based on the response so far it seems that either very few people are interested in such a feature or not too many people know how to go about doing this. Maybe this would make a good topic for the next coding competition.

Ashen worked on something like this before but he is digging through a stack of backups to try and help me out. If I'm not mistaken he mentioned that he used capitalization for the words that must stand out and I suppose he then tracked the mouse click coords. Even though it is not exactly what I want it may give me just enough to get started,

As for the text rendering "thing", I have no idee how to do it but if you can give me some info as to how to go about it I'll give it a shot.

Thanks
#92
Hi
I created a GUI in my game that represents a PDA. As part of the functionality I want the player to be able to research certain topics that would become available as the game progresses. I'm using a text box on the GUI to display the information in string format, which is updated if and when an objective is met, and it also includes the ability to view previous entries (this part works fine). The problem I have is that I want to be able to display certain words in the text in a different colour and then also enable the player to click on the text to “jump” to a different entry on the PDA that would supply more information. If anyone has played Gabriel Knight III (Blood of the sacred blood of the damned) and can recall the “SYDNEY” computer used by Grace, which is exactly what I'm looking for. and if you are not familiar with the game then a better comparison is the way the threads in the forum works.

Example:

John and Joe played Tic-Tac-Toe

If you click on the highlighted word you jump to another page

Tic-Tac-Toe
A game invented by Fred Finklestein in 1215 AD. The game consist of a grid made up of 3 x3 squares ……Back

When you click on Back it jumps back to the previous text above

I searched all the threads and although the topic has come up before nobody came up with a solution that can help me in any way and I have no idea where to even start with this.

Can anyone throw me a bone here please.

Thanks

#93
I do not know if this code will work with the latest version of AGS but the code goes into global script and assuming the GUI is called gSetviewp and you have a button on it = button 0 it would look something like this:

Code: ags


#sectionstart interface_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
Ã,  if ((interface == SETVIEWP) &&(button ==0)){
Ã,  Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  SetViewport(mouse.x*30,mouse.y*30);
Ã,  Ã,  Ã,  Ã, }
Ã,  Ã, }


Take a look at THIS thread although it does not deal with your specific issue it will give you a lot of insight on how to handle a click event on a GUI.

EDIT:
As Ashen mentioned below, this has become redundant and although it still works fine its not the best way of doing it.

#94
I know it is a little late in the game and Ashen has done some great work (as always) but I also struggled with a cellphone GUI some time ago and my solution was to open the GUI by pressing "P" on the keyboard as I found this to be much easier than changing the cursor mode. I used the following code:

In top of global script (under variables)
Code: ags


//======================================================
//Control to pop up the Cellphone GUI
//======================================================
function Show_Cellphone(){
// Called when the "P" key is pressed to activate the GUI
gGuiphone.Visible = true;
gGuiphone.Backgroundgraphic = 51;
Wait(5);
gGuiphone.Backgroundgraphic = 52;
Wait(5);
gGuiphone.Backgroundgraphic = 53;
Wait(5);
gGuiphone.Backgroundgraphic = 54;
Wait(5);
gGuiphone.Backgroundgraphic = 55;
Wait(5);

#sectionstart on_key_pressÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) {
Ã,  // called when a key is pressed. keycode holds the key's ASCII code

if (keycode=='P') Show_Cellphone(); //Show Cellphone GUI


In global script header:

Code: ags

import Show_Cellphone();


To close the GUI I used one of the buttons on the phone.

If nothing else this gives you another view on how it can be done.





   
#95
If I inderstand you correctlyÃ,  THIS part of the manual should solve your problem.

EDIT:
Duh. KhrisMUC already told you that.  Only noticed now that he referenced the same page. Sorry about that but age will do this to you.
#96
Just click on GUI in the main menu and then on the statusline GUI in the GUI editor (no.0 in the list) and change the visibility property to popup modal in the dialogue box that pops up. If you need to call up the GUI at any time then just write code to call it as per Sunwalker's example.

Edit

You can find more info on this HERE
#97
Hints & Tips / Re: Crave
Mon 04/09/2006 21:56:02
Where is the cellar that everyone is talking about. I've been everywhere and the only place that I can think of is the door next to the laundry bin but it is locked?

EDIT

Duh! Found it!
#98
Before the sky comes down on me, yes I know not to double post but I took this thread to PM with Wretched so he could explain a few things to me that I didn't understand. Seems there was more than just a bit and he would probably spend the next few days in rehab after this. Sorry Wretched!!

What I have managed to sort out at this point is to convert the Hotspots and Regions to BoardX and Y coords and then from BoardX and Y coords to SreenX an Y coords. I tested this with the display function and all seems to be working fine. Now I have to set up and array or struct to track the objects on the board and needless to say I have only a very faint idea of what it entails. Just to make it easier to assist me, this is the board I'm using (just a test)


(Thanks Neole)

BoardX = 0 at the bottom left square and 7 at bottom right square
Board Y =0 at bottom squares and 7 at top squares

What I have done so far:

In the main header script
Code: ags

struct sBoardSquare {
Ã,  int gamepiece;
Ã,  bool up;
Ã,  bool down;
Ã,  bool left;
Ã,  bool right;
Ã,  
};

import sBoardSquare Board[64];



In the main global script
Code: ags

sBoardSquare Board[64];


#sectionstart game_startÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
Ã,  // called when the game starts, before the first room is loaded

Code: ags

Ã,  
Board[0].gamepiece = 0;
Board[0].down = false;
Board[0].left = false;
Board[0].right = false;
Board[0].up = false;

.....

Board[63].gamepiece = 0;
 Board[63].down = false;
Board[63].left = true;
Board[63].right = false;
Board[63].up = true;
	Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
export Board;

Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, 
This gives me the 64 squares on an 8 x 8 board (think I got them the wrong way round, Board[0] should be bottom left square and not top left, I think)

The problem is that there is no link to the actual squares..can I use this in the main global script to index the board?
Code: ags

sBoardSquare Board[BoardSquareY*BoardSize+BoardSquareX];


Looks like it should work but wouldn't that mean that I have to declare a different struct to keep track of the up,down,left,right restrictions?
How would I track the movement of the gamepiece as it moves around?

Any help would be appreciated.
Just in case anyone is wondering, yes I checked every single thread and the above code is the best I can do with what I've learned.Ã,  :P
#99
If I'm not mistaken the room should scroll by itself when the character gets close to the edge but if you want to scroll without moving the character then take a look at this thread
#100
Wretched,
Quote from: Wretched on Mon 14/08/2006 07:47:34
The idea is to use the HotSpots and Regions as two seperate masks that work together, You use (Version 2.72 code)

I'm using Version 2.71 but I do not think that is a huge problem as everything so far is pretty much the same for both versions and I'll change it where necessary.

Quote from: Wretched on Mon 14/08/2006 07:47:34

function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
Ã,  Hotspot* Hot;
Ã,  Region* Reg;

Ã,  if (button==eMouseLeft)
Ã,  {
Ã, Ã,  Ã, Hot=Hotspot.GetAtScreenXY(mouse.x,mouse.y);Ã, 
Ã, Ã,  Ã, Reg=Region.GetAtRoomXY(mouse.x, mouse.y);

Ã,  Ã,  if (Hot.ID!=0 && Reg.ID!=0)
Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã, BoardSquareX=Hot.ID-1;
Ã,  Ã,  Ã,  Ã, BoardSquareY=Reg.ID-1;
Ã,  Ã,  Ã,  Ã, ClickOnBoard=true;
Ã,  Ã,  }
Ã,  Ã,  else
Ã,  Ã,  {
Ã,  Ã,  Ã,  ClickOnBoard=false;
Ã,  Ã,  }
}


I understand this part but just cannot figure out why you used this:
BoardSquareX=Hot.ID-1; // Why theÃ,  -1?
BoardSquareY=Reg.ID-1;// Why the - 1?

The way I understand the above code is that BoardSquare X = the hotspot found at the screen XY's ID less one. If it happens to be Hotspot 1 then you'll come up with Hotspot 0 which does not exist. So if the object I want to move is one square A1 (assuming it is bottom left) and I click on A2 (going up on the vertical) it won't go anywhere.

Quote from: Wretched on Mon 14/08/2006 07:47:34

Ã,  ky=1.0-(IntToFloat(SY)-81.0)/(220.0-81.0);Ã,  //ky=1.0 at bottom, ky=0.0 at top
Ã,  Ã,  //81.0 is vertical centre of top row
Ã,  Ã,  //220.0 is vertical centre of bottom row

Now I get it. The (225.0 - 89.0) in the initial code confused me because it was different from the values assigned in the function: function Screen XY(int x, int y).

Quote from: Wretched on Mon 14/08/2006 07:47:34
Ã,  kx=(IntToFloat(x))/(IntToFloat(BoardSize-1));

This gives me a float (kx) that is 0.0 at the left of the board and 1.0 at the right of the board.
Sorry BoardSize is the size of the Board, so 8 in my case. (as 8x8 Board). Actually would be better to use BoardSizeX in case you have a rectangular board.

Am I correct in saying that I just have to declare an int variable and initialize it to e.g
BoardSize = 8; // I'm using a standard 8x8 square board

I know some of my question seem pretty basic to an expert like you but I just hate using something if I do not understand exactly what its about. If I do not learn from it I might as well ask someone to just make the game for me. Be that as it may I'm sure that I'm boring and or anoying some of the other members, so if you don't mind couching me on this through PM I would appreciate it.

Thanks!
SMF spam blocked by CleanTalk