YolkfolkThe Dizzy Fansite 0 logged in0 playing
Community discussion

No Escape from in-game menus

Started by OO7Samurai on 7 October 2023 • 784 views

8 posts
#91848

Hey All - I'm still very slowly plugging away. I'm wanting to have some in-game menus...maybe a bit more like magic knight...maybe...like some of the characters offering multiple objects and you can only take one. Anyway, I've just about got that working except you can 'esc' out of the menu and that crashes me out of the game with a BADARGTYPE, 0,1.

Basically - is there anyway of making it so Esc doesn't do anything in menus?

Ta!!

ps - I think I said a while back I'd hoped to get a test version out by the end of summer....HA!

👍 0
#91849

So - a bit of a spoiler - but this is what I've got so far...

/////////////////////////////////////
// SHAMUS MENU
/////////////////////////////////////
func OpenDialogShamusMenu()
{
GamePause(1);
select = RunDialogSelect( gs_fid("DialogShamusMenu"), 3, 0 );
if(select==0)
{
 
idx = ObjFind(1231);
 
}
else
if(select==1)
{
 
idx = ObjFind(1149);
 
 
}
else
if(select==2)
{
 
idx = ObjFind(1137);
 
}
 
GamePause(0); 
 
if (idx == (ObjFind(1231)))
{Message26(3,0,"THE GOLF BALL?\nOK SO!");
Message26(4,3,"I'VE NOT BEEN ASKED\nBACK TO CADDY SINCE\n1964 ANYWAY!");
MessagePop();
PickupObject(idx);
 
}
 
if (idx == (ObjFind(1149)))
{Message26(3,1,"TOILET ROLL?");
Message26(4,2,"NO MATTER,\nI TOOK IT\nFROM ME GUEST-HOUSE\nJACKS ANWAY!");
MessagePop();
PickupObject(idx);
}
 
 
if (idx == (ObjFind(1137)))
{Message26(3,1,"ME BELOVED HAT?");
Message26(4,3,"NO BOTHER...SOB\nIT'S YOURS!");
GameCommand(CMD_REFRESH); 
MessagePop();
PickupObject(idx);
shamus = BrushFind(45873492);
shamus2 = BrushFind(45873496);
hat = BrushFind(45873493);
BrushSet(shamus,B_DRAW,0);
BrushSet(shamus2,B_DRAW,3);
BrushSet(hat,B_DRAW,0);
Message26(4,3,"  BUT BEFORE YOU ASK  \nI BEAT THAT CHICKEN..");
Message26(4,3,"  BUT BEFORE YOU ASK  \nI BEAT THAT CHICKEN..\nAND DON'T BE LISTENING\nTO ANYONE WHO'D\nTELL YOU OTHERWISE!");
}
shamus = BrushFind(45873492);
shamus2 = BrushFind(45873496);
hat = BrushFind(45873493);
wall1 = BrushFind(45873494);
wall2 = BrushFind(45873495);
wall3 = BrushFind(45873498);
 
Message26(13,5,"ANYWAYS\nENOUGH OF THIS,");
Message26(3,7,"I NEED TO BE GOING.\nJUST ONE LAST THING...");
Message26(5,9," YOU MUST NEVER ");
Message26(5,9," YOU MUST NEVER \nNEVER EVER");
Message26(5,9," YOU MUST NEVER \nNEVER EVER\nEVER");
Message26(5,9," YOU MUST NEVER \nNEVER EVER\nEVER\nENTER THE HENGE!");
 
BrushSet(shamus,B_DRAW,0);
BrushSet(shamus2,B_DRAW,0);
BrushSet(hat,B_DRAW,0);
BrushSet(wall1,B_DRAW,0);
BrushSet(wall2,B_DRAW,0);
BrushSet(wall3,B_DRAW,0);
idx = ObjFind(24422992);
ObjSet(idx,O_DISABLE,0);
idx = ObjFind(4422992);
ObjSet(idx,O_DISABLE,0);
 
 
GameCommand(CMD_REFRESH); 
MessagePop();
 
 
}
 
func DialogShamusMenu(select)
{
tile1 = "{c:ffffff}{t:1231 0 -5}    {c:ff0000}";
tile2 = "{c:ffffff} {t:1149 0 -5}    {c:ff0000}";
tile3 = "{c:ffffff}  {t:1137 0 -5}    {c:ff0000}";
text = "{a:center}{c:0xff00c800}ANY ONE YOU FANCY!\n\n\n{c:0xff00c800}";
if(select==0) text += tile1 + "{f:1}A GOLF BALL       {f:0}\n\n"; else text += tile1 + "{c:0xff00c800}A GOLF BALL       \n\n";
if(select==1) text += tile2 + "{f:1}T-ROLL            {f:0}\n\n"; else text += tile2 + "{c:0xff00c800}T-ROLL            \n\n";
if(select==2) text += tile3 + "{f:1}ME BEST HAT       {f:0}\n"; else text += tile3 + "{c:0xff00c800}ME BEST HAT       \n";
DialogPush();
DialogSetText(text);
DialogSetColor(0xff005800);
DialogFitCenter();
}
 
👍 0
#91851

Personally, I'd always use a dialog choice for choosing a particular response. In Dizzy's Oddest Adventure, he has the choice of travel by using a 'goblin key card' on certain trees which brings up a menu for travel options. But you can use the idea for anything and if you want a second option for doing stuff, then just recreate the code and call it 'dialogchoice1' etc.

Here's a rough idea

func ActionObject_200 //shamus
{
ida = ObjFind(200);
if (ObjGet(ida, O_STATUS) == 0)
{Message1 (4,3, "\"Hello you English pig, I've got three objects, but you can only have one\""); MessagePop()
OpenDialogChoice(); return;}
if (ObjGet(ida, O_STATUS) == 1)
{Message1 (4,3, "\"Be off with you, you English pig!\""); MessagePop();}}

func DialogChoice (select)
{
text = "{a:center} OBJECT CHOICE\n\n{c:oxff0000}";
if (select==1) text += "{f:1} GOLF BALL{F:0}\n"; else text += "GOLF BALL\n";
if (select==2) text += "{f:1} TOILET ROLL{F:0}\n"; else text += "TOILET ROLL\n";
if (select==0) text += "{f:1} BEST HAT{F:0}\n"; else text += "BEST HAT\n";
DialogPush();
DialogSetText(text);
DialogSetColor(COLOR_DIALOG);
DialogFitCentre();
}


func OpenDialogChoice()
{
ida = ObjFind(200);
GamePause(1);
norefuse = 0;
select = RunDialogSelect (gs_fid ("DialogChoice"),3,0, norefuse);
if (select==0) {idx = ObjFind(203); ObjSet(idx, O_DISABLE, 0); ObjSet(ida, O_STATUS, 1);} //best hat
if (select==1) {idx = ObjFind(201); ObjSet(idx, O_DISABLE, 0); ObjSet(ida, O_STATUS, 1);} // golf ball
if (select==2) {idx = ObjFind(202); ObjSet(idx, O_DISABLE, 0); ObjSet(ida, O_STATUS, 1);} // toilet roll
GamePause(0);
}

note: the 0 selection appears at the bottom, where the 'highlighted object appears first. Pressing escape won't crash the game, it just ends the conversation and you have to action Shamus again to restart the conversation. The second part (status 1) won't action until the chosen object has been dropped. In this version you have placed all three items by Shamus, but set them as disabled.

I have changed the content of Messages.GS in my games so that you just have to start each conversation with Message something - best to use 0 for stuff you read or comments in white. 1 for the main character and 2 onwards for other characters all in different colours. Saves a lot of extra coding. You can change any of the conversations to suit your gameplay, Hopefully this just gives you something extra to toy with.

PS - why do you always use such huge numbers for ids, it must make it so hard to type each one accurately

👍 0
#91852

Nice one ta - I'll give this a good look at tonight. 

Haha - long IDs are because I haven't planned one single bit of the game...it has all come together organically. The start of Ko Tapu is pretty much the very first bit of Editos leanring I did with the family, and we started bashing-in random numbers to make sure we didn't have duplicates...and so it continues 🤣 

👍 0
#91854

@grandad - In the end I just added this:

else
{GamePause(0); return;}

 

after all the parts like this:

if(select==1)
{
 
idx = ObjFind(1149);
 
So while I kept the script in menu.gs, in all actuality you did solve it for me...because when I saw your 'norefuse' bit I thought to myself "Oh...I'm not giving it an option for if nothing is selected" - and bob's your uncle!
 
right...now to ctrl C and Ctrl V all over the place!
👍 0
#91855

Glad I can help... although I don't generally plan my games either - and just keep on adding bits, but I am a little bit sad in that I keep a note of all the ids in running order as I have lots of little extra functions that I created to make typing easier, such as 'blockon(id)' and 'block off(id) for switching the material of blocks on and off - you won't believe the size of my Utility.gs file {eggs2}:contract:  

👍 1
#91872

Hmm. I don't know if I've got anything in utility.gs....maybe why my game.gs is 35,000 lines😖

👍 0
#91891

A mere 35,000 lines. You'll soon end up what I do and just leave spaces rather than add a new line for everything. It makes it a lot easier to check problems if you don't have to keep on scrolling up and down. Checking the correct number of curly brackets - that's what your fingers are for {yolkfolk}:thumb:   ... or you could just add new .gs files and list them in the Dizzy.gs file making sure the game.gs is the last name. Saves a lot of scrolling too.

func ActionObject_250()

{Dizzyback(); WaitFrames(10); Message1 (4,3, "\"Oh no!!\""); MessagePop(); PlayerSetPos(2400,546); Dizzyfront();}
👍 0