Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (MadJack, AndrewAMD, Quad), 540 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
actions in your script #83328
07/26/06 11:06
07/26/06 11:06
Joined: Apr 2006
Posts: 83
M
MDC Offline OP
Junior Member
MDC  Offline OP
Junior Member
M

Joined: Apr 2006
Posts: 83
How do i put knew actions in my script, like where exactly do i write them or just anyway. give detail. im kinda slow.

Re: actions in your script [Re: MDC] #83329
07/26/06 11:31
07/26/06 11:31
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
aztec Offline

Expert
aztec  Offline

Expert

Joined: Apr 2005
Posts: 2,332
Germany, BaWü
this is very simple you just define actions this:

action simple
{



}

thats a simple definition dont place the actions before the function main (its just my tip) you can give moddels or perfabs action in WED just click at them properties and then you´ll see all the actions you wrote
I hopw this helps you
Regards
Aztec


Visit:
schwenkschuster-design.de
Re: actions in your script [Re: aztec] #83330
07/26/06 12:27
07/26/06 12:27
Joined: Apr 2006
Posts: 83
M
MDC Offline OP
Junior Member
MDC  Offline OP
Junior Member
M

Joined: Apr 2006
Posts: 83
i did that my action wasnt there when i tries to put it in.

Re: actions in your script [Re: MDC] #83331
07/27/06 21:16
07/27/06 21:16
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
after you write the action in your script file you have to re-open your level or to reload your script file ... it doesnt update the action list if you dont do this...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: actions in your script [Re: EpsiloN] #83332
07/28/06 06:33
07/28/06 06:33
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline
User
Frits  Offline
User

Joined: Mar 2006
Posts: 724
the Netherlands
In WED;
File-->Preferences-->Tab Advanced
Set 'Reload of externally modified files'to Auto.

Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: actions in your script [Re: Frits] #83333
08/03/06 04:55
08/03/06 04:55
Joined: Dec 2005
Posts: 11
Wisconsin
TKN Offline
Newbie
TKN  Offline
Newbie

Joined: Dec 2005
Posts: 11
Wisconsin
Is there a way to switch actions using c-script commands? For example I want pressing F8 to toggle between action PlBiped01 and action player_swim, even though by default the level should start with the player using action PlBiped01 (so I set that action in the Behaviour panel for that entity in WED).

Re: actions in your script [Re: TKN] #83334
08/03/06 08:07
08/03/06 08:07
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
aztec Offline

Expert
aztec  Offline

Expert

Joined: Apr 2005
Posts: 2,332
Germany, BaWü
Yes I think its possible you can use handles or entities I think
entity* action;
entity* action2;
action 1
{
if(F8 != pressed)
{
action = me;
rest of action...
}
}

action 2
{
if(F8 == pressed)
{
action2 = me;
rest of action
}

But i dont know If it works I think it wont but at least I tried
maybe learn a bit more about handels I think


Visit:
schwenkschuster-design.de
Re: actions in your script [Re: aztec] #83335
08/18/06 01:28
08/18/06 01:28
Joined: Dec 2005
Posts: 11
Wisconsin
TKN Offline
Newbie
TKN  Offline
Newbie

Joined: Dec 2005
Posts: 11
Wisconsin
OK, what I did was have the F8 key call a function that toggles the value of a variable, so that the value is either 0 or 1. Then in the action PlBiped01, I immediately use an "if" to check the value of the variable. If the value is 0, I call the action swim_mode; else I continue with the rest of the PlBiped01 code.

Here is the code that toggles the value of that variable:

Code:

var is_swim_mode_on = 0;

function toggle_swim_mode() {
beep;
if (is_swim_mode_on == 1) {
is_swim_mode_on = 0;
bipedPhy01_gravity = 9;
msg_show ("Fly mode is off", 5);
} else {
is_swim_mode_on = 1;
bipedPhy01_gravity = 0;
msg_show ("Fly mode is on: press Space to jump/move up, and 'c' to move down", 5);
}
}

on_f8 = toggle_swim_mode;



The code for the PlBiped01 action:

Code:
  
action PlBiped01
{
if (is_swim_mode == 1) {
swim_mode();
} else {
// the rest of PlBiped01 action code
}
}



I should point out though that the PlBiped01 action is a bit more complicated, because the first time it runs it sets up several threads to update the animation and the sound, and these threads continue to run until you remove the player entity. So in fact what I have above is only an example, and it does not apply cleanly to the PlBiped01 action. To do this properly, the toggling function has to remove the existing biped entity so that those extra threads stop, then create a new entity so that when the action is next invoked it can call swim_mode() cleanly without having those extra threads hanging around.

Last edited by TKN; 08/18/06 01:33.
Re: actions in your script [Re: TKN] #83336
08/18/06 13:27
08/18/06 13:27
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
You should place your codes inside a while-loop, otherwise
it never call swim_mode() even is_swim_mode == 1.

Code:

action PlBiped01
{
while(my != NULL)
{
if (is_swim_mode == 1)
{
swim_mode();
} else {
// the rest of PlBiped01 action code
}
wait(1);
}
}



Re: actions in your script [Re: vlau] #83337
08/25/06 03:31
08/25/06 03:31
Joined: Dec 2005
Posts: 11
Wisconsin
TKN Offline
Newbie
TKN  Offline
Newbie

Joined: Dec 2005
Posts: 11
Wisconsin
Actually there is no need to add the while loops you mention, because the swim_mode() function and the part that I referred to as "the rest of the PlBiped01 action code" each set up their own threads and while loops. If you look at the template scripts PlBiped01.wdl and move.wdl and movement.wdl you can see the two actions yourself (swim_mode and PlBiped01).


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1