ID:1047050
 
(See the best response by Zohan98.)
Problem description:
I am a little stuck here. When pressing run, the world directly loads the map. Now I have to create a main menu screen. How do I stop the map from loading and load the images for menu?

In short how do I create the main menu first?

Thanks in advance.
Regards

Never mind. Got it.

Regards.
I am totally stuck here. Can someone give me some idea how to do it. No input/output interfaces. Just images with mouse click.

mob
var
mob/player

MobPlayer
Login()
MainMenu() // This is menu button(obj) with one create button
// This will be called once player is created
CreatePlayer()
PlayerHud()
..()

Here is the create player proc
    proc
CreatePlayer()
switch(usr.Race)
if("Human")
player = new/mob/Human()
if("Elf")
player = new/mob/Elf()
//player.loc = locate(16,25,1)
player.loc = locate(/turf/portal01)
//player.loc = locate(/turf/portal02)
src.client.mob = player
..()
del(src)


Thanks in advance
Regards
Best response
There are multiple ways you can preform this task, although i'm not going to spoon-feed you and script it for you but provide some guidelines.

1 way to do this process is by using the Interface option, which gives you a handful of powerful controls you can use to customize your window, how the way you want. The clicks will be controlled by a widget called "Button"(Well, most of them)

Another way is to do it the old fashion way(which for some odd reason I do not support.) By placing images onto your map and controlling your user to the objects placed on the map with:
usr.client.eye
usr.client.prespective


By positioning the user's eye over parts of the map.

Now clickable objects can be done something like this...
obj
CLASSES
icon = 'CLASSES.dmi'
Class1
icon_state = "1"
Click(mob/m)
//wut happens when u click on dis class.
Class2
icon_state = "2"
Click(mob/m)
//wut happens when u click on dis class.
Class3
icon_state = "3"
Click(mob/m)
//wut happens when u click on dis class.

etc. etc. Try exploring with these options, if you need any help just be sure ask.



I have set up everything. The only thing that I still don't understand is the login. Either my mainmenu shows up or the level. Both are working as expected. The problem is it ain't going one after another. Mainmenu should come before login. That's what I don't understand how to do!
I am using interface, just don't want to use it in main menu.
A little confusing!
Thanks for the reply.

Regards
You can use a procedure called
winshow(who,"nameofwindow",1 or 0) //1 meaning SHOW.

You can ALSO prevent windows from showing up when the
mob/Login()

is called.
By:
Right clicking on the window and clicking edit> and uncheck Visible....
so it would go something like this...

mob
verb
Login()
set category = 1
winshow(usr,"Login",0)
winshow(usr,"Customization",1)
//this can also be done by winset(usr,"Customization","is-visible=true"), they both serve the same purpose.

Yes, that is how I am doing. Everything is working fine.
Only thing which is not working is the above function - CreatePlayer(), only if I call the function MainMenu(). If I remove mainmenu function and just call the createplayer function it works. if I call the mainmenu function (like above), only mainmenu and other hud/interfaces works. It does not create the player.
Say, I have a button (e.g - create) in mainmenu function which is an obj. I only want to call the CreatePlayer() function when it is clicked than login.
I think I should take time to understand login and complete the other staff first then come back to mainmenu.

Thanks for your help and time.
Regards
Can i see the MainMenu() proc?
In mainmenu, it only contain the creation of hud obj and its placement on screen. Some clickable button and some background images, like a normal game menu. So that player can select the race - Human or Elf etc. than load the character (call CreatePlayer() function).
I don't want to use any interface window in mainmenu. Only plain png images (clickable buttons). That's it.

When the world is created, is it possible to hold the mob -
world
mob = mob/MobPlayer


In spite of creating the mob, create the Mainmenu -
world
MainMenu()

Then when click the "Create" button in menu -
   Click()
// world/mob = mob/MobPlayer

Something like that!
Else I should take time.

Thanks,
Regards.
Can i still see your mainmenu proc ._.
Sure -
   proc
MainMenu()
mainMenu = new(src)
mainMenu.show()

Here is the mainmenu class
MainMenu
parent_type = /obj
var
obj/MenuBox/menuBack
obj/MenuButton/createButton

New()
..()
menuBack = new/obj/MenuBox(m_icon='data/hud/CreatePlayerHud.png',s_loc="4,2", b_name="menuBack", i_state="menuBack", m_id="MenuBack", m_layer=1)
menu_box += menuBack
createButton = new/obj/MenuButton(s_loc="17,2", b_name="create", i_state="create", m_id="Create", m_layer=2)
menu_box += createButton

proc
show()
usr.client.screen += menu_box

hide()
usr.client.screen -= menu_box

Here is button click -
obj
Click()
..()
usr.MenuButtonClick(src)

In MenuButtonClick(), it checks for the .name of the obj and if true processes the call, if any.

Regards
You are calling CreatePlayer at login. You should give the player a chance to choose a race first.
mob
MobPlayer
Login()
MainMenu()
//CreatePlayer() // don't call this
//PlayerHud() // maybe this too
..()


Then
obj/MenuButton
Click()
if(istype(usr,/mob/MobPlayer))
var/mob/MobPlayer/mob = usr
mob.CreatePlayer()
return ..()


Note: No usr in procs. The only exemption is in mouse operations.
Yes, this is what I have been looking for. Thanks for the reply.
Once I understand clearly, how to use what and where, I will replace that - usr.

Thank you,
Regards.