|
Script Factory
#127640
05/02/07 13:35
05/02/07 13:35
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
OP
Expert
|
OP
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
I´m a bit bored and I´d like to script something. Following aztec, DwX and all the others before, I offer you, to post what kind of Script you´d like to have and I will try to realize it and post the working script here. What I won´t do is pathfinding and menues. Thanks Slin
|
|
|
Re: Script Factory
[Re: Slin]
#127641
05/02/07 13:56
05/02/07 13:56
|
Joined: Mar 2005
Posts: 969 ch
Loopix
User
|
User
Joined: Mar 2005
Posts: 969
ch
|
How about a simple script for handling a custom player name? Should be possible to: -input the name string somewehre in the startmenu of the game -calling the string (player name) whenever I want to I know, this is not really challenging for you...but it would save me at least an hour
|
|
|
Re: Script Factory
[Re: aztec]
#127643
05/02/07 14:48
05/02/07 14:48
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
OP
Expert
|
OP
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
Loopix: Code:
font font_Player = "arial",1,20; string str_PlayerName = "Player";
text txt_PlayerNameIn { pos_x = 0; pos_y = 0; layer = 15; font = font_Player; strings = 2; string = "Player Name: ",str_PlayerName; }
function func_PlayerNameIn(PosX,PosY,SizeX,SizeY) { txt_PlayerNameIn.Pos_x = PosX; txt_PlayerNameIn.Pos_y = PosY; SizeX += PosX; SizeY += PosY; txt_PlayerNameIn.visible = on; while(txt_PlayerNameIn.visible) { if( mouse_left && mouse_pos.x > PosX && mouse_pos.x < SizeX && mouse_pos.y > PosY && mouse_pos.y < SizeY) { inkey(str_PlayerName); } wait(1); } }
Just call the function "func_PlayerNameIn(PosX,PosY,SizeX,SizeY)" if you want to change the playername. PosX and PosY is the Position where the name gets displayed. You´ll have to click on the displayed text to change it so you have to say how big the text is with SizeX and SizeY. If you want to make it invisible, just call txt_PlayerNameIn.visible = off; out of a function. The player name is stored in the string "str_PlayerName". @aztec: I will try it when I´m done with my homework. It shouldn´t be very hard either
Last edited by Slin; 05/02/07 14:56.
|
|
|
Re: Script Factory
[Re: Loopix]
#127646
05/02/07 18:42
05/02/07 18:42
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
OP
Expert
|
OP
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
This should be, what you are looking for aztec: Code:
define EventString_count, 3; //Number of instructions
font font_EventInput = "arial",1,20; string str_EventInput;
text txt_EventInput { pos_x = 0; pos_y = 0; layer = 15; font = font_EventInput; strings = 2; string = "Instruction: ",str_EventInput; }
text txt_EventInput_strings { strings = EventString_count; string = "help","talk","trade"; //these are the posible instructions }
function func_CompareStrings(StringIn) //Compare the strings { var counter; while(counter < EventString_count) { if(str_cmpi(StringIn,txt_EventInput_strings.string[counter])){return(counter);} counter += 1; } }
function func_EventInput(PosX,PosY) { var InkeyReturn; var InstructionID; txt_EventInput.Pos_x = PosX; txt_EventInput.Pos_y = PosY; txt_EventInput.visible = on; InkeyReturn = inkey(str_EventInput); if(1 < InkeyReturn < 27) { InstructionID = func_CompareStrings(str_EventInput); } txt_EventInput.visible = off; if(InstructionID == 0) //if the input was help, { wait(1); //do something } if(InstructionID == 1) //if the input was talk, { wait(1); //do something } if(InstructionID == 2) //if the input was trade, { wait(1); //do something } }
function func_MdlEventInput_event() { if(event_type == event_click) { func_EventInput(mouse_pos.x,mouse_pos.y); //Place the text at the mouse position } }
action func_MdlEventInput() //Example Action { my.enable_click = on; my.event = func_MdlEventInput_event; }
|
|
|
Re: Script Factory
[Re: Realspawn]
#127649
05/02/07 19:29
05/02/07 19:29
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
OP
Expert
|
OP
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
Nice library, Realspawn @all: I´ve got some time so please post what you´d like to get scriptet... Slin
|
|
|
|