Jump to content


Photo

Need help with show_message_ext function


  • Please log in to reply
8 replies to this topic

#1 tntboss95

tntboss95

    GMC Member

  • GMC Member
  • 90 posts
  • Version:GM8

Posted 26 June 2012 - 08:53 PM

Hi i wonder what show_message_ext do.
So far i know it shows a message and creates 3 buttons.
What i want is when u click a button a variable change, as an example when i click button 'Join' then (guildjoin=false) changes to (guildjoin=true) and trigger that event.
(
if guildjoin=true //<<<(want help with this!)
{
guild_name=get_string('What is the Guilds name?','')
writebyte(130); //<<<<<<send byte to server trigger a case>>>>>
writestring(guild_name); //send to server and to search a ini the guild's name
writestring(global.username); //Player Joined Guild
sendmessage(global.clienttcp);
}
)

Is this possible?



Sry for the confusing code(just a example i made) here:



if guildmessage=true //message comes up!!
{
message_background(back112)
message_button(spr_messbtn)
if show_message_ext('Do you want to Join or Create a Guild?','Join','Create','Exit',) // 3 buttons trigger guildjoin=false to guildjoin=true and soo on
guildexit=true
{
if guildjoin=true 
{
guild_name=get_string('What is the Guilds name?','')
writebyte(130); //<<<<<<send byte to server trigger a case>>>>>
writestring(guild_name); //send to server and to search a ini (the guild's name)
writestring(global.username); //Player Joined Guild
sendmessage(global.clienttcp);
}
if guildcreate=true 
{
guild_name=get_string('What name will your Guild have?','')
writebyte(129); //<<<<<<send byte to server trigger a case>>>>>
writestring(guild_name); //guilds name sended to server, for create a ini with that name
writestring(global.username); //Guild leader
sendmessage(global.clienttcp); 
}
if guildexit=true
{
guildmessage=false //exit message
}
}}

  • 0

#2 The Black Dragon

The Black Dragon

    Remake

  • GMC:Member
  • 160 posts
  • Version:GM8

Posted 26 June 2012 - 09:10 PM

This is how does work.
Spoiler

I'm going to edit my post to make your code.

Done.
Spoiler

Edited by The Black Dragon, 26 June 2012 - 09:26 PM.


#3 Debels

Debels

    GMC Member

  • GMC Member
  • 1997 posts
  • Version:GM:Studio

Posted 26 June 2012 - 09:16 PM

Hi i wonder what show_message_ext do.
So far i know it shows a message and creates 3 buttons.
What i want is when u click a button a variable change, as an example when i click button 'Join' then (guildjoin=false) changes to (guildjoin=true) and trigger that event.
(
if guildjoin=true //<<<(want help with this!)
{
guild_name=get_string('What is the Guilds name?','')
writebyte(130); //<<<<<<send byte to server trigger a case>>>>>
writestring(guild_name); //send to server and to search a ini the guild's name
writestring(global.username); //Player Joined Guild
sendmessage(global.clienttcp);
}
)

Is this possible?



Sry for the confusing code(just a example i made) here:

-snip-

you can change that code for this:

if guildmessage=true //message comes up!!
{
message_background(back112)
message_button(spr_messbtn)
result=show_message_ext('Do you want to Join or Create a Guild?','Join','Create','Exit',)
switch (result){
case default://If the user presses enter do this
guildmessage=false //exit message
break;
case 1://If the user presses join do this
guild_name=get_string('What is the Guilds name?','')
writebyte(130); //<<<<<<send byte to server trigger a case>>>>>
writestring(guild_name); //send to server and to search a ini (the guild's name)
writestring(global.username); //Player Joined Guild
sendmessage(global.clienttcp);
break;
case 2://If the user presses create do this
guild_name=get_string('What name will your Guild have?','')
writebyte(129); //<<<<<<send byte to server trigger a case>>>>>
writestring(guild_name); //guilds name sended to server, for create a ini with that name
writestring(global.username); //Guild leader
sendmessage(global.clienttcp); 
break;
case 3://If the user presses exit do this
guildmessage=false //exit message
break;
}
}

If you have any question just ask me :P

Edited by Debels, 26 June 2012 - 09:17 PM.

  • 1

#4 tntboss95

tntboss95

    GMC Member

  • GMC Member
  • 90 posts
  • Version:GM8

Posted 27 June 2012 - 10:57 AM

thx alot, both of you! rep point added :)

I have a little offtopic question how to add a string in a ini file instead of replace?
if u didnt understand so i can show what i mean

Edited by tntboss95, 27 June 2012 - 11:00 AM.

  • 0

#5 Debels

Debels

    GMC Member

  • GMC Member
  • 1997 posts
  • Version:GM:Studio

Posted 27 June 2012 - 10:00 PM

thx alot, both of you! rep point added :)

I have a little offtopic question how to add a string in a ini file instead of replace?
if u didnt understand so i can show what i mean

ini_open("data.ini");
ini_write_string(Section,Key,string);
ini_close();
You just have to change key with another name example

ini_open("data.ini");
ini_write_string("Data","Name","Debels");
ini_write_string("Data","Class","Warrior");
ini_close();

and such for different string :P
  • 0

#6 tntboss95

tntboss95

    GMC Member

  • GMC Member
  • 90 posts
  • Version:GM8

Posted 29 June 2012 - 07:09 PM


thx alot, both of you! rep point added :)

I have a little offtopic question how to add a string in a ini file instead of replace?
if u didnt understand so i can show what i mean

ini_open("data.ini");
ini_write_string(Section,Key,string);
ini_close();
You just have to change key with another name example

ini_open("data.ini");
ini_write_string("Data","Name","Debels");
ini_write_string("Data","Class","Warrior");
ini_close();

hm, i know xD i meant this(ask me if u dont understand):

ini_write_string("Player","Playerslot_1",username); //if this is written in ini file
ini_write_string("Player","Playerslot_2",username); // then write this, and if this is written then,
ini_write_string("Player","Playerslot_3",username); // then write this, and so on

thx anyway :)

and such for different string :P


Edited by tntboss95, 29 June 2012 - 07:10 PM.

  • 0

#7 Debels

Debels

    GMC Member

  • GMC Member
  • 1997 posts
  • Version:GM:Studio

Posted 29 June 2012 - 07:29 PM



thx alot, both of you! rep point added :)

I have a little offtopic question how to add a string in a ini file instead of replace?
if u didnt understand so i can show what i mean

ini_open("data.ini");
ini_write_string(Section,Key,string);
ini_close();
You just have to change key with another name example

ini_open("data.ini");
ini_write_string("Data","Name","Debels");
ini_write_string("Data","Class","Warrior");
ini_close();

hm, i know xD i meant this(ask me if u dont understand):

ini_write_string("Player","Playerslot_1",username); //if this is written in ini file
ini_write_string("Player","Playerslot_2",username); // then write this, and if this is written then,
ini_write_string("Player","Playerslot_3",username); // then write this, and so on

thx anyway :)

and such for different string :P


oh, easy just use this code:

ini_open("file.ini");//Open the ini file
if (ini_key_exists("Player","Playerslot_1")){//Check if Playerslot_1 exists
    if (ini_key_exists("Player","Playerslot_2")){//Check if Playerslot_2 exists
        ini_write_string("Player","Playerslot_3",username);//Since Playerslot_1 and Playerslot_2 exist write to Playerslot_3
    }else{//Since Playerslot_2 doesn't exist write to it
        ini_write_string("Player","Playerslot_2",username);
    }
}else{//Since Playerslot_1 doesn't exist write to it
    ini_write_string("Player","Playerslot_1",username);
}
ini_close();//Close the ini file

  • 0

#8 tntboss95

tntboss95

    GMC Member

  • GMC Member
  • 90 posts
  • Version:GM8

Posted 30 June 2012 - 05:34 PM

thx alot will put u in the credits :)
  • 0

#9 Debels

Debels

    GMC Member

  • GMC Member
  • 1997 posts
  • Version:GM:Studio

Posted 30 June 2012 - 05:50 PM

thx alot will put u in the credits :)

No problem :), Great :D
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users