A working in-game computer...

C

Chris White

Guest
So I'm working on this game where you play as a worker at a terminal-like computer. I want to be able to interact with the computer... as a computer. For example, being able to open and close programs, buy and sell items through web browser. If you have ever played Grand Theft Auto V, there is a web browser in game you can scroll through and go to different websites. I want this to be a little like that. I know I could have a separate room for each program and website, but that is a lot of rooms...is there any other way of doing this? Maybe I'm just being lazy, I don't know. Any help would be appreciated.

Thanks
-Chris
 
D

Dengar

Guest
draw commands and variables. that's all you should need.
think about it like a webpage, its just a bunch of words and pictures, so do just that, draw words and pictures based on your variables.
 
C

Chris White

Guest
draw commands and variables. that's all you should need.
think about it like a webpage, its just a bunch of words and pictures, so do just that, draw words and pictures based on your variables.
Could you elaborate on that a bit more? How would I use the draw commands and variables to open and close programs and interact with the webpages?
 
A

Aura

Guest
You'll need an extension to run external programs because GM:S doesn't support that natively:

https://marketplace.yoyogames.com/assets/575/execute-shell

...and you'll need an extension for bypassing the Sandboxing too.

Either way, if you're not yet familiar with draw commands and interaction with the game, I'd suggest you to drop the idea and consult the Manual and other learning resources:

http://docs.yoyogames.com/source/dadiospice/002_reference/drawing/index.html

http://docs.yoyogames.com/source/da...mouse, keyboard and other controls/index.html

http://docs.yoyogames.com/source/da...01_gml language overview/variables/index.html
 
C

Chris White

Guest
You'll need an extension to run external programs because GM:S doesn't support that natively:

https://marketplace.yoyogames.com/assets/575/execute-shell

...and you'll need an extension for bypassing the Sandboxing too.

Either way, if you're not yet familiar with draw commands and interaction with the game, I'd suggest you to drop the idea and consult the Manual and other learning resources:

http://docs.yoyogames.com/source/dadiospice/002_reference/drawing/index.html

http://docs.yoyogames.com/source/dadiospice/002_reference/mouse, keyboard and other controls/index.html

http://docs.yoyogames.com/source/dadiospice/002_reference/001_gml language overview/variables/index.html
I do know what draw commands and variables are I just don't understand how I would use them in this case. Also, I'm not intending on using real programs. I was thinking there would programs on your computer in game that you can open to access different things, such as a store, the news, your email, whatever I decide to put in. The only way I could think of doing this is having each desktop icon be an object and when you click on that object it will take you to an identical room with the only difference being that the program is now open and then you can click on other icons within that program that take you to other rooms and so on. That could get very complicated (and probably already is) with so many different rooms. Needless to say I would have a lot of folders and sub folders :D
 
C

CheeseOnToast

Guest
You can make a IsProgram variable which when you select an app on this computer, it will load that app ID, for example...

if in the game the player clicks the internet icon (most likely an object)

Code:
obj_computerAppController.IsProgram=1
obj_computerAppController.LoadedApp=0 //Set this to 0 on each app start
Have a computer controller object decide what to show (obj_computerAppController):

Code:
if IsProgram == 1 // Internet Explorer
{
    if LoadedApp== 0
   {
          //draw and create events for interaction.
         LoadedApp=1
   }
}
You can expand the ID's by how many programs you want your ingame computer to have.
 
D

Dengar

Guest
umm, ok. are you needing to open real webpages on the real internet or are you simply needing your game to have the illusion of opening webpages.
if all you need is the illusion, then simply create that. an illusion.

open ms_paint and draw a website(doesn't have to look good)
next draw a few buttons that are on that webpage.
create objects and give them the button picture sprites.

now you need a control object to draw your "website"
next give each of your "button objects" mouse click code. that code will change what website your control object is drawing.

keep everything in the same room. just change what "website picture" is being drawn and what "button objects" exist.
 
C

Chris White

Guest
I ended up using the instance_create code to spawn in the right objects in the right places when you, for example, power on the computer or click on an icon, etc. I'm now working on figuring out some way to make a delay when you turn on and off the computer so it can play a sound and an animation. Thanks for all the help. If you see any issues with this let me know, I could be leaving some possibilities out.
 
D

Dengar

Guest
use an alarm. when you click the button to turn it on. do your bootup animations and then when the alarm goes off draw the rest of your website cause its now loaded
 
C

Chris White

Guest
use an alarm. when you click the button to turn it on. do your bootup animations and then when the alarm goes off draw the rest of your website cause its now loaded
I've been trying that but it doesn't seem to be working. In the poweron button object i have it setting the alarm for 3 seconds (90 steps) then playing the sound. in alarm[0] i have it creating all the objects needed. When i click the power on button in game it will play the sound but after 3 seconds nothing happens.
 
D

Dengar

Guest
make sure the power on button object only sets the alarm once. it might be resetting the alarm every step=possibly ur problem.
 
C

Chris White

Guest
make sure the power on button object only sets the alarm once. it might be resetting the alarm every step=possibly ur problem.
it is under a "left released" event so when i click on the object it will set the alarm. I made another object to display alarm[0], it starts at -1 and when i click on the powerbutton it doesn't change.
 
C

Chris White

Guest
Code:
//obj_poweron left released
alarm[0] = room_speed * 3
audio_play_sound(snd_windowson, 10, false);
instance_destroy();

//obj_poweron alarm0
instance_create(0,0, obj_desktop);
instance_create(402,102, obj_browserbutton);
instance_create(987,612, obj_poweroff);
I was thinking that left released will pay the sound and animation and when it ends the alarm will spawn in the desktop and other objects.
 
D

Dengar

Guest
the alarm your setting is local to that object, so when you use instance destroy the alarm is lost.
so either remove the instance_destroy. or use a variable "ison" if false then you can left release to turn it on. then change it to true. that way u can only turn it on once.

let me kno how it works
 
C

Chris White

Guest
the alarm your setting is local to that object, so when you use instance destroy the alarm is lost.
so either remove the instance_destroy. or use a variable "ison" if false then you can left release to turn it on. then change it to true. that way u can only turn it on once.

let me kno how it works
Wow, I would have never thought of that. I just moved the instance_destroy to the alarm event and it works perfectly. Thank you so much! :D
 

ZeDuval

Member
Surely not the best, but yet another possible way would be to have one room to build all "webpages" next to each other and change the room port according to the "navigation". *shrug*

edit: Now that I think about it...This way you can use the combined functionality of backgrounds, tiles, objects and the draw-event. Also it might be the most simple way to build scrollable webpages.
 
Last edited:
Top